]> git.mxchange.org Git - friendica.git/blob - src/Core/Lock/ILockDriver.php
39e4ba8e89809ccbfa46cd727ebea75aafff0706
[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          *
14          * @brief Acquires a lock for a given name
15          *
16          * @param string  $key      The Name of the lock
17          * @param integer $timeout  Seconds until we give up
18          *
19          * @return boolean Was the lock successful?
20          */
21         public function acquireLock(string $key, int $timeout = 120);
22
23         /**
24          * @brief Releases a lock if it was set by us
25          *
26          * @param string $key The Name of the lock
27          *
28          * @return void
29          */
30         public function releaseLock(string $key);
31
32         /**
33          * @brief Releases all lock that were set by us
34          *
35          * @return void
36          */
37         public function releaseAll();
38 }