| 1 | <?php |
||
| 9 | class LockManager |
||
| 10 | { |
||
| 11 | /*** @var LockStoreInterface */ |
||
| 12 | protected $lockStore; |
||
| 13 | |||
| 14 | /*** @var array */ |
||
| 15 | protected $acquiredLocks = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param LockStoreInterface |
||
| 19 | */ |
||
| 20 | public function __construct(LockStoreInterface $lockStore) |
||
| 24 | |||
| 25 | public function __destruct() |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string |
||
| 35 | * @param int |
||
| 36 | * @return bool |
||
| 37 | */ |
||
| 38 | public function acquire($key, $lockTtl) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param string |
||
| 51 | * @return bool |
||
| 52 | */ |
||
| 53 | public function release($key) |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @return LockStoreInterface |
||
| 66 | */ |
||
| 67 | public function getLockStore() |
||
| 71 | |||
| 72 | protected function prepareLockKey($key) |
||
| 76 | } |
||
| 77 |