]> git.mxchange.org Git - friendica.git/blob - src/Core/Lock/ILockDriver.php
Merge pull request #6732 from MrPetovan/bug/1777-fix-blocked-contact-group
[friendica.git] / src / Core / Lock / ILockDriver.php
1 <?php
2
3 namespace Friendica\Core\Lock;
4 use Friendica\Core\Cache;
5
6 /**
7  * Lock Driver Interface
8  *
9  * @author Philipp Holzer <admin@philipp.info>
10  */
11 interface ILockDriver
12 {
13         /**
14          * Checks, if a key is currently locked to a or my process
15          *
16          * @param string $key           The name of the lock
17          * @return bool
18          */
19         public function isLocked($key);
20
21         /**
22          *
23          * Acquires a lock for a given name
24          *
25          * @param string  $key      The Name of the lock
26          * @param integer $timeout  Seconds until we give up
27          * @param integer $ttl      Seconds The lock lifespan, must be one of the Cache constants
28          *
29          * @return boolean Was the lock successful?
30          */
31         public function acquireLock($key, $timeout = 120, $ttl = Cache::FIVE_MINUTES);
32
33         /**
34          * Releases a lock if it was set by us
35          *
36          * @param string $key      The Name of the lock
37          * @param bool   $override Overrides the lock to get released
38          *
39          * @return void
40          */
41         public function releaseLock($key, $override = false);
42
43         /**
44          * Releases all lock that were set by us
45          *
46          * @return void
47          */
48         public function releaseAll();
49 }