private static function createConnection() { $serverProfile = Predis_RedisServerProfile::get('2.2'); $connection = new Predis_Client(RC::getConnectionArguments(), $serverProfile); $connection->connect(); $connection->select(RC::DEFAULT_DATABASE); return $connection; }
public function validate($option, $value) { if ($value instanceof Predis_RedisServerProfile) { return $value; } if (is_string($value)) { return Predis_RedisServerProfile::get($value); } throw new InvalidArgumentException("Invalid value for option {$option}"); }
function testRedisServerProfile_CommandsRegistration() { $profile = Predis_RedisServerProfile::get('1.0'); $cmdId = 'mset'; $cmdClass = 'Predis_Commands_SetMultiple'; $this->assertFalse($profile->supportsCommand($cmdId)); $profile->registerCommand(new $cmdClass(), $cmdId); $this->assertTrue($profile->supportsCommand($cmdId)); $this->assertInstanceOf($cmdClass, $profile->createCommand($cmdId)); }