mirror of
https://github.com/predis/predis.git
synced 2026-08-24 13:39:27 +00:00
23 lines
665 B
PHP
23 lines
665 B
PHP
<?php
|
|
|
|
namespace Predis\Options;
|
|
|
|
class ClientKeyDistribution extends Option {
|
|
public function validate($value) {
|
|
if ($value instanceof \Predis\Distribution\IDistributionStrategy) {
|
|
return $value;
|
|
}
|
|
if (is_string($value)) {
|
|
$valueReflection = new \ReflectionClass($value);
|
|
if ($valueReflection->isSubclassOf('\Predis\Distribution\IDistributionStrategy')) {
|
|
return new $value;
|
|
}
|
|
}
|
|
throw new \InvalidArgumentException("Invalid value for key distribution");
|
|
}
|
|
|
|
public function getDefault() {
|
|
return new \Predis\Distribution\HashRing();
|
|
}
|
|
}
|