redis()->set($this->getCacheKey($key), $value, $expires); } /** * 获取缓存数据 * * @param string $key 缓存标识 * @return false|mixed|string */ public function get(string $key) { return $this->redis()->get($this->getCacheKey($key)); } /** * 删除 String 缓存 * * @param string $key 缓存标识 * @return bool */ public function delete(string $key): bool { return (bool)$this->redis()->del($key); } /** * 判断缓存是否存在 * * @param string $key 缓存标识 * @return bool */ public function isExist(string $key): bool { return (bool)$this->get($key); } /** * 获取缓存过期时间 * * @param string $key 缓存标识 * @return bool|int */ public function ttl(string $key) { return $this->redis()->ttl($this->getCacheKey($key)); } }