3 namespace Friendica\Core\Lock;
5 use Friendica\Core\Cache;
10 * @author Philipp Holzer <admin@philipp.info>
15 * Checks, if a key is currently locked to a or my process
17 * @param string $key The name of the lock
21 public function isLocked($key);
25 * Acquires a lock for a given name
27 * @param string $key The Name of the lock
28 * @param integer $timeout Seconds until we give up
29 * @param integer $ttl Seconds The lock lifespan, must be one of the Cache constants
31 * @return boolean Was the lock successful?
33 public function acquire($key, $timeout = 120, $ttl = Cache\Duration::FIVE_MINUTES);
36 * Releases a lock if it was set by us
38 * @param string $key The Name of the lock
39 * @param bool $override Overrides the lock to get released
41 * @return boolean Was the unlock successful?
43 public function release($key, $override = false);
46 * Releases all lock that were set by us
48 * @param bool $override Override to release all locks
50 * @return boolean Was the unlock of all locks successful?
52 public function releaseAll($override = false);
55 * Returns the name of the current lock
59 public function getName();
64 * @param string prefix optional a prefix to search
66 * @return array Empty if it isn't supported by the cache driver
68 public function getLocks(string $prefix = '');