TP6使用Redis缓存

use think\facade\Cache;

$this->redis = Cache::store('redis')->handler();

$this->redis->set($key, $value, $expire);

$this->redis->get($key);

$this->redis->del($key);

$this->redis->setnx($key, $value);  //key存在时value不被覆盖

$this->redis->hSet($key, $hashKey, $value);

$this->redis->hMSet($key, $value);  //多个 value为array

$this->redis->hGet($key, $hashKey);

$this->redis->hGetAll($key);

$this->redis->lPush($key, $value);

$this->redis->rPop($key);  //右

$this->redis->lPop($key);  //左

$this->redis->lRange($key, $start, $end);

$this->redis->lLen($key);