LockBackend
1 year ago
DistributedList.php
1 year ago
Lock.php
1 year ago
LockBackend.php
2 years ago
LockBackend.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Matomo - free/libre analytics platform |
| 5 | * |
| 6 | * @link https://matomo.org |
| 7 | * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 8 | */ |
| 9 | namespace Piwik\Concurrency; |
| 10 | |
| 11 | interface LockBackend |
| 12 | { |
| 13 | /** |
| 14 | * Returns lock keys matching a pattern. |
| 15 | * |
| 16 | * @param $pattern |
| 17 | * @return string[] |
| 18 | */ |
| 19 | public function getKeysMatchingPattern($pattern); |
| 20 | /** |
| 21 | * Set a key value if the key is not already set. |
| 22 | * |
| 23 | * @param $lockKey |
| 24 | * @param $lockValue |
| 25 | * @param $ttlInSeconds |
| 26 | * @return mixed |
| 27 | */ |
| 28 | public function setIfNotExists($lockKey, $lockValue, $ttlInSeconds); |
| 29 | /** |
| 30 | * Get the lock value for a key if any. |
| 31 | * |
| 32 | * @param $lockKey |
| 33 | * @return mixed |
| 34 | */ |
| 35 | public function get($lockKey); |
| 36 | /** |
| 37 | * Delete the lock with key = $lockKey if the lock has the given value. |
| 38 | * |
| 39 | * @param $lockKey |
| 40 | * @param $lockValue |
| 41 | * @return mixed |
| 42 | */ |
| 43 | public function deleteIfKeyHasValue($lockKey, $lockValue); |
| 44 | /** |
| 45 | * Update expiration for a lock if the lock with the specified key has the given value. |
| 46 | * |
| 47 | * @param $lockKey |
| 48 | * @param $lockValue |
| 49 | * @param $ttlInSeconds |
| 50 | * @return mixed |
| 51 | */ |
| 52 | public function expireIfKeyHasValue($lockKey, $lockValue, $ttlInSeconds); |
| 53 | } |
| 54 |