1 | <?php |
||
8 | class RedisConnection implements Connection |
||
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 | * RedisConnection 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 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: