]> git.mxchange.org Git - friendica.git/blob - src/Core/Lock/ILockDriver.php
Adding multihost - locking
[friendica.git] / src / Core / Lock / ILockDriver.php
1 <?php
2
3 namespace Friendica\Core\Lock;
4
5 /**
6  * Lock Driver Interface
7  *
8  * @author Philipp Holzer <admin@philipp.info>
9  */
10 interface ILockDriver
11 {
12         /**
13          * @brief Checks, if a key is currently locked to a or my process
14          *
15          * @param string $key           The name of the lock
16          * @return bool
17          */
18         public function isLocked($key);
19
20         /**
21          *
22          * @brief Acquires a lock for a given name
23          *
24          * @param string  $key      The Name of the lock
25          * @param integer $timeout  Seconds until we give up
26          *
27          * @return boolean Was the lock successful?
28          */
29         public function acquireLock($key, $timeout = 120);
30
31         /**
32          * @brief Releases a lock if it was set by us
33          *
34          * @param string $key The Name of the lock
35          *
36          * @return void
37          */
38         public function releaseLock($key);
39
40         /**
41          * @brief Releases all lock that were set by us
42          *
43          * @return void
44          */
45         public function releaseAll();
46 }