1 | <?php |
||
11 | class NinjaMutexLockAdapter implements LockAdapterInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var LockInterface |
||
15 | */ |
||
16 | private $ninjaMutexLock; |
||
17 | |||
18 | /** |
||
19 | * @var null|int |
||
20 | */ |
||
21 | private $timeout; |
||
22 | |||
23 | /** |
||
24 | * @param LockInterface $ninjaMutexLock |
||
25 | * @param null|int $timeout 1. null if you want blocking lock |
||
26 | * 2. 0 if you want just lock and go |
||
27 | * 3. $timeout > 0 if you want to wait for lock some time (in milliseconds) |
||
28 | */ |
||
29 | public function __construct(LockInterface $ninjaMutexLock, $timeout = null) |
||
34 | |||
35 | /** |
||
36 | * @param string $resourceName |
||
37 | * @return bool |
||
38 | */ |
||
39 | public function acquireLock($resourceName) |
||
43 | |||
44 | /** |
||
45 | * @param string $resourceName |
||
46 | * @return bool |
||
47 | */ |
||
48 | public function releaseLock($resourceName) |
||
52 | |||
53 | /** |
||
54 | * @param string $resourceName |
||
55 | * @return bool |
||
56 | */ |
||
57 | public function isLocked($resourceName) |
||
61 | } |
||
62 |