Merge pull request #15826 from seamuslee001/dev_core_183_dedupe
[civicrm-core.git] / Civi / Core / Lock / LockInterface.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11 namespace Civi\Core\Lock;
12
13 /**
14 * Lock interface.
15 */
16 interface LockInterface {
17
18 /**
19 * Acquire lock.
20 *
21 * @param int|null $timeout
22 * The number of seconds to wait to get the lock.
23 * For a default value, use NULL.
24 * @return bool
25 */
26 public function acquire($timeout = NULL);
27
28 /**
29 * @return bool|null|string
30 * Trueish/falsish.
31 */
32 public function release();
33
34 /**
35 * @return bool|null|string
36 * Trueish/falsish.
37 * @deprecated
38 * Not supported by some locking strategies. If you need to poll, better
39 * to use acquire(0).
40 */
41 public function isFree();
42
43 /**
44 * @return bool
45 */
46 public function isAcquired();
47
48 }