加密字符串
@param string $str 字符串
@param string $key 加密key
@param integer $expire 有效期（秒） 0 为永久有效
@return string
778027
public static function encrypt($data,$key,$expire=0){
        if(empty(self::$handler)){
            self::init();
        }
        $class  =   self::$handler; 
        return $class::encrypt($data,$key,$expire);
    }
1049324
public function set(string $key, $value, int $expire = null): bool {
		if ($value instanceof Closure) {
			$value = $value();
		}
		return $this->driver->set($key, static::serialize($value), $expire ?? $this->expire);
	}
121917
public function set($key, $value, $expire = 0)
    {
        $value = json_encode($value, JSON_UNESCAPED_UNICODE);
        if ($expire > 0) {
            return $this->hash($key)->setex($key, $expire, $value);
        } else {
            return $this->hash($key)->set($key, $value);
        }
    }
413901
function set($key, $value, $expire = 0)
    {
        if ($expire <= 0)
        {
            $expire = 0x7fffffff;
        }
        return $this->redis->setex($key, $expire, serialize($value));
    }
3560
protected function doSet(string $srcKey, $data, int $expire = self::EXPIRE): bool
    {
        // 获取文件名与文件位置
        list ($key, $path, $sqlPath) = $this->getFile($srcKey);

        // 创建目录
        makeDir(dirname($path));

        // 保存缓存数据
        write($path, serialize($data), LOCK_EX);

        // 保存缓存的键
        write($sqlPath, $srcKey, LOCK_EX);

        // 取出目录,修改,保存回去
        $fileList = $this->getFileList();
        $fileList[$key] = $expire + time();
        $this->setFileList($fileList);

        return true;
    }
25207
public function set($key, $val, $expire = 0)
    {
        return $this->mem->set($key, $val, $expire);
    }
568872
public function decrypt($str=null, $key=null)
    {
        if (!is_null($key)) {
            $this->setSalt($key);
        }
        $str = self::getEncryptionKey(base64_decode($str));
        $tmp = '';
        for ($ctr=0;$ctr<strlen($str);$ctr++) {
            $md5 = substr($str,$ctr,1);
            $ctr++;
            $tmp.= (substr($str,$ctr,1) ^ $md5);
        }
        return $tmp;
    }
709766
public function store($key, $data, $expiration = 0)
    {
        $compress_data = gzcompress($data, 9);
        $storeData = array(
            'time' => time(),
            'expire' => $expiration,
            'data' => base64_encode($compress_data)
        );
        if (true === is_array($this->_loadCache())) {
            $dataArray = $this->_loadCache();
            $dataArray[$key] = $storeData;
        } else {
            $dataArray = array($key => $storeData);
        }
        $cacheData = json_encode($dataArray);

        file_put_contents($this->getCacheDir(), $cacheData);
        return $this;
    }
111151
public function add($key, $value, $expiration = null)
    {

        return $this->set($key, $value, $expiration);
    }
1215778
public static function set(string $key, $value, int $expire = null): bool
    {
        return self::storage()->set($key, $value, $expire);
    }
217956
public function storageLogin($key, $data, $expire = 0)
    {
        $ticket = md5(time() . rand(1000, 9999) . serialize($data));
        $key = $this->getKey($key);
        
        // 设置Cookie
        Cookie::set($key, $ticket, $expire);
        
        // 缓存数据
        Cache::set($ticket, $data, $expire);
    }
1079189
public function set($key, $value, $expiration = false)
    {
        $path = $this->filename($key);
        $umask = umask($this->umask);
        file_put_contents($path, $this->createValue($value, $expiration));
        umask($umask);
        return $this;
    }
391185
public function set($name, $value, $expire = null) {
        if (is_null($expire)) {
            $expire = $this->options['expire'];
        }
        //$key = $name;
        //对数组/对象数据进行缓存处理，保证数据完整性
        $value = (is_object($value) || is_array($value)) ? json_encode($value) : $value;
        if (is_int($expire) && $expire) {
            $result = $this->handler->setex($name, $expire, $value);
        }
        else {
            $result = $this->handler->set($name, $value);
        }
        return $result;
    }
489211
public function expireAfter($key, $expire = 0)
    {
        $val = $this->mem->get($key);

        if (isset($val)) {
            return $this->set($key, $val, $expire);
        }

        return false;
    }
918586
public function cache($key=true,$expire=null,$type=''){
        // 增加快捷调用方式 cache(10) 等同于 cache(true, 10)
        if(is_numeric($key) && is_null($expire)){
            $expire = $key;
            $key    = true;
        }
        if(false !== $key)
            $this->options['cache']  =  array('key'=>$key,'expire'=>$expire,'type'=>$type);
        return $this;
    }
988260
public function header( $key, $str = null ) 
	{
		if ( !is_null( $str ) ) 
		{
			$this->_header[$key] = $str; return $this;
		}

		return $this->_header[$key];
	}
400386
public function set($key, $value, $expire = 0)
    {
        if ($this->expire) {
            $expire = $this->expire;
        }

        return $this->handle->set($key, $value, $expire);
    }