Conditions | 1 |
Paths | 1 |
Total Lines | 6 |
Code Lines | 2 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | protected function acquireLock(string $key, ?string $connection_name = null): bool |
||
11 | { |
||
12 | $lockKey = 'lock:' . $key; |
||
|
|||
13 | // Tenta di acquisire il lock con un timeout di 10 secondi |
||
14 | //return $this->redis->getRedisConnection($connection_name)->set($lockKey, '1', 'NX', 'EX', 10); |
||
15 | return $this->redis->getRedisConnection($connection_name)->set($key, 1, 'EX', 10, 'NX'); |
||
16 | } |
||
40 |