Add new command: GEORADIUS (Redis 3.2.0).

This commit is contained in:
Daniele Alessandri
2016-05-24 17:09:06 +02:00
parent b2284d015f
commit 00000fde4e
14 changed files with 405 additions and 0 deletions
+26
View File
@@ -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'),
);
}
}