Skip to content

Commit 6ba8abe

Browse files
committed
impl. memcached
1 parent 5167551 commit 6ba8abe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mutex/MemcachedMutex.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ public function __construct(string $name, Memcached $memcache, float $timeout =
3737

3838
protected function acquire(string $key, float $expire): bool
3939
{
40-
return $this->memcache->add($key, true, $expire);
40+
// memcached supports only integer expire
41+
// https://github.com/memcached/memcached/wiki/Commands#standard-protocol
42+
$expireInt = (int) ceil($expire);
43+
44+
return $this->memcache->add($key, true, $expireInt);
4145
}
4246

4347
protected function release(string $key): bool

0 commit comments

Comments
 (0)