'redis' => [
//集群模式只在service下使用有效,异步redis中并不适用
'cluster' => true,
'cluster_options' => [
'connect_timeout' => 2,
'read_timeout' => 2,
'connect' => 'persistence',
'prefix' => 'groupa:',
],
'clusters' => [
'default' => [
'host' => '127.0.0.1',
'port' => 6382,
],
'redis1' => [
'host' => '127.0.0.1',
'port' => 6380,
],
'redis2' => [
'host' => '127.0.0.1',
'port' => 6381,
],
],
],
use Cache;
//key value expireTime
Cache::set('ha', 123, 60);
//也可以这样
Cache::redis() -> set('haa', 123, 60);
Cache::get('ha');
Cache::mGet(['ha', 'aa']);
Cache::hSet($hashKey, $key, $data, $expireTime);
Cache::hGet($hashKey, $key);
Cache::hDel($hashKey, $key);
Cache::hDel($hashKey);
//现在的类库方法还未扩展完全,目前只有以上方法