Differences Between: [Versions 39 and 400] [Versions 400 and 402] [Versions 400 and 403]
MySQL / MariaDB locking factory.
Copyright: | Brendan Heywood <brendan@catalyst-au.net> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 196 lines (6 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
mysql_lock_factory:: (10 methods):
get_unique_db_prefix()
__construct()
is_available()
supports_timeout()
supports_auto_release()
supports_recursion()
get_lock()
release_lock()
extend_lock()
auto_release()
Class: mysql_lock_factory - X-Ref
MySQL / MariaDB locking factory.get_unique_db_prefix($type) X-Ref |
Return a unique prefix based on the database name and prefix. return: string. param: string $type - Used to prefix lock keys. |
__construct($type) X-Ref |
Lock constructor. param: string $type - Used to prefix lock keys. |
is_available() X-Ref |
Is available. return: boolean - True if this lock type is available in this environment. |
supports_timeout() X-Ref |
Return information about the blocking behaviour of the lock type on this platform. return: boolean - Defer to the DB driver. |
supports_auto_release() X-Ref |
Will this lock type will be automatically released when a process ends. return: boolean - Via shutdown handler. |
supports_recursion() X-Ref |
Multiple locks for the same resource can NOT be held by a single process. Hard coded to false and workaround inconsistent support in different versions of MySQL / MariaDB. return: boolean - false |
get_lock($resource, $timeout, $maxlifetime = 86400) X-Ref |
Create and get a lock return: boolean - true if a lock was obtained. param: string $resource - The identifier for the lock. Should use frankenstyle prefix. param: int $timeout - The number of seconds to wait for a lock before giving up. param: int $maxlifetime - Unused by this lock type. |
release_lock(lock $lock) X-Ref |
Release a lock that was previously obtained with @lock. return: boolean - true if the lock is no longer held (including if it was never held). param: lock $lock - a lock obtained from this factory. |
extend_lock(lock $lock, $maxlifetime = 86400) X-Ref |
Extend a lock that was previously obtained with @lock. return: boolean - true if the lock was extended. param: lock $lock - a lock obtained from this factory. param: int $maxlifetime - the new lifetime for the lock (in seconds). |
auto_release() X-Ref |
Auto release any open locks on shutdown. This is required, because we may be using persistent DB connections. |