mirror of
https://github.com/predis/predis.git
synced 2026-08-24 18:59:36 +00:00
Add new command: GEORADIUS (Redis 3.2.0).
This commit is contained in:
@@ -129,6 +129,31 @@ class ReplicationStrategy
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a GEORADIUS command is a readable operation by parsing the
|
||||
* arguments array of the specified commad instance.
|
||||
*
|
||||
* @param CommandInterface $command Command instance.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isGeoradiusReadOnly(CommandInterface $command)
|
||||
{
|
||||
$arguments = $command->getArguments();
|
||||
$argc = count($arguments);
|
||||
|
||||
if ($argc > 5) {
|
||||
for ($i = 5; $i < $argc; $i++) {
|
||||
$argument = strtoupper($arguments[$i]);
|
||||
if ($argument === 'STORE' || $argument === 'STOREDIST') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks a command as a read-only operation.
|
||||
*
|
||||
@@ -261,6 +286,7 @@ class ReplicationStrategy
|
||||
'GEOHASH' => true,
|
||||
'GEOPOS' => true,
|
||||
'GEODIST' => true,
|
||||
'GEORADIUS' => array($this, 'isGeoradiusReadOnly'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user