marow-dev/redis-connector
Composer 安装命令:
composer require marow-dev/redis-connector
包简介
Redis client
关键字:
README 文档
README
Redis client
Connecting to redis
$connection = RedisConnector\Connection();
If connection cant be established RedisConnector\ConnectorException is thrown.
Default connection parameters are:
hostname: localhost
port: 6379
Client
$client = new RedisConnector\Client(new RedisConnector\Connection());
Sending commands to redis
$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).
Exceptions Codes
- 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
Example
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);
}
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-11