function RedisStore::exists
Overrides PersistingStoreInterface::exists
File
-
vendor/
symfony/ lock/ Store/ RedisStore.php, line 203
Class
- RedisStore
- RedisStore is a PersistingStoreInterface implementation using Redis as store engine.
Namespace
Symfony\Component\Lock\StoreCode
public function exists(Key $key) : bool {
$script = '
local key = KEYS[1]
local uniqueToken = ARGV[2]
-- asserts the KEY is compatible with current version (old Symfony <5.2 BC)
if redis.call("TYPE", key).ok == "string" then
return false
end
' . $this->getNowCode() . '
-- Remove expired values
redis.call("ZREMRANGEBYSCORE", key, "-inf", now)
if redis.call("ZSCORE", key, uniqueToken) then
return true
end
return false
';
return (bool) $this->evaluate($script, (string) $key, [
microtime(true),
$this->getUniqueToken($key),
]);
}