1 | <?php |
||
8 | class RedisLockStore implements LockStore |
||
9 | { |
||
10 | /** @var float */ |
||
11 | const CLOCK_DRIFT_FACTOR = 0.01; |
||
12 | |||
13 | /** @var int */ |
||
14 | const REDIS_EXPIRES_PRECISION = 2; |
||
15 | |||
16 | /** @var \Redis */ |
||
17 | private $redis; |
||
18 | |||
19 | /** |
||
20 | * RedisLockStore constructor. |
||
21 | * |
||
22 | * @param \Redis $redis |
||
23 | */ |
||
24 | 24 | public function __construct(\Redis $redis) |
|
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | 6 | public function set(Lock $lock, $ttl = null) |
|
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 6 | public function exists($resource) |
|
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 6 | public function delete(Lock $lock) |
|
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | 3 | public function getDrift($ttl) |
|
86 | } |
||
87 |