set($key, $val, $expire); } /** * 获取 * @param $key * @return bool */ public static function get($key){ $cacheData = self::instance()->get($key); $data = $cacheData? json_decode($cacheData, true) : []; if(empty($data)){ $data = $cacheData; } return $data; } /** * 删除 * @param $key * @return bool */ public static function del($key){ return self::instance()->rm($key); } /** * 递增 * @param $key * @return bool */ public static function inc($key, $step=1){ return self::instance()->inc($key, $step); } /** * 递减 * @param $key * @return bool */ public static function dec($key, $step=1){ return self::instance()->dec($key, $step); } /** * 批量删除 * @param $key * @return bool */ public static function delByKeys($key){ return self::instance()->rms($key); } /** * 右入队处理 * @param $key * @param $data */ public static function rpush($key, $data){ return self::instance()->rpush($key, $data); } /** * 左入出处理 * @param $key */ public static function lpop($key){ return self::instance()->lpop($key); } /** * 设置有效时间 * @param $key * @param $expire * @return mixed */ public static function expire($key, $expire){ return self::instance()->expire($key, $expire); } /** * 键名是否存在 * @param $key * @param $expire * @return mixed */ public static function exists($key){ return self::instance()->exists($key); } }