phpBB API Documentation
Class

phpbb\lock\db

class db

Database locking class

Methods

__construct($config_name, config $config, driver_interface $db)

Creates a named released instance of the lock.

acquire()

Tries to acquire the lock by updating the configuration variable in the database.

owns_lock()

Does this process own the lock?

null release()

Releases the lock.

Details

at line 61
public __construct($config_name, config $config, driver_interface $db)

Creates a named released instance of the lock.

You have to call acquire() to actually create the lock.

Parameters

$config_name
config $config
driver_interface $db

at line 80
public acquire()

Tries to acquire the lock by updating the configuration variable in the database.

As a lock may only be held by one process at a time, lock acquisition may fail if another process is holding the lock or if another process obtained the lock but never released it. Locks are forcibly released after a timeout of 1 hour.

at line 122
public owns_lock()

Does this process own the lock?

at line 138
public null release()

Releases the lock.

The lock must have been previously obtained, that is, acquire() call was issued and returned true.

Note: Attempting to release a lock that is already released, that is, calling release() multiple times, is harmless.

Return Value

null