Redis client
$connection = RedisConnector\Connection();
If connection cant be established RedisConnector\ConnectorException is thrown.
Default connection parameters are:
hostname: localhost
port: 6379
$client = new RedisConnector\Client(new RedisConnector\Connection());
$client = new RedisConnector\Client(new RedisConnector\Connection());
$client->set('key', 'value');
Most popular commands are methods in RedisConnector\Client class (get, set, etc.). You can issue other commands by using RedisConnector\Client object (class RedisConnector\Client implements magic method __call).
- 10000 - Connection cannot be established
- 10001 - Not connected to redis
- 10002 - Response read error
- 10003 - Error generated by Redis
- 10004 - Command send error
- 10100 - No response method
- 10200 - Data is not an object
- 10201 - Data is not an array
- 10202 - Wrong key
try {
$client = new RedisConnector\Client(new RedisConnector\Connection());
$client->set('test', 'value of key test');
$testValue = $client->get('test');
} catch ($e RedisConnector\ConnectorException) {
var_dump($e);
}