General plugins (Local): More lock factories

Maintained by Me!Damyon Wiese
Additional lock factories for the new locking framework. Supports memcache and memcached.
3 sites
1 fans
Moodle 2.7, 2.8, 2.9, 3.0, 3.1, 3.2

Moodle 2.7 introduces a locking api for critical tasks (e.g. cron).

The type of locking used can be set to one of the lock factories contained in this plugin.

by changing the $CFG->lock_factory setting in config.php.


$CFG->lock_factory = "\\local_morelockfactories\\memcache_lock_factory";

The 2 lock factories contained in this plugin are:

"\\local_morelockfactories\\memcache_lock_factory" - Memcache locking

The memcache lock type depends on an external Memcache server to hold

the locks. It is dangerous to use this lock type with a Memcache server

that is also used for other purposes. If the memcache server deletes the

locks to reclaim space - the locks will be released. Also if memcache

is restarted, all cluster nodes also need to be restarted because their

active locks will have been released.

"\\local_morelockfactories\\memcached_lock_factory" - Memcached locking

The memcached lock type is identical to the memcache lock type except

it uses the memcached extension rather than the memcache one.

To configure the memcache server that is used for locking with either factory,

set the config variable:

$CFG->lock_memcache_url = 'localhost:11211';

The memcache server url should consist of the memcache server hostname and optionally

the port. E.g. localhost:11211


Screenshot #0


Damyon Wiese (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Anthony Borrow
    Tue, Apr 15, 2014, 1:45 PM
    Damyon - Many thanks for sharing this plugin with the Moodle community.

    I noticed that you did not specify an issue tracker for your plugin. Providing a place for uses of your plugin to report issue encourages participation and provides a way for users to report bugs, make feature requests, or suggest other types of improvements. There are a couple of options. You are welcome to request hat a component be created in the Moodle Tracker. Alternatively, for folks using, you can use the issues feature of Github to handle such requests. Kindly let me know which of these two options seems best for you.

    Please provide a documentation URL. You are welcome to create your documentation in Moodle Docs, See for more information.

    I am not sure a screen shot makes much sense but more of description might be helpful to help folks understand what this plugin is really about. Peace - Anthony
Please login to post comments