设置缓存，按需重载
@param string $cachename
@param mixed $value
@param int $expired
@return boolean
183241
protected function setCache($cachename,$value,$expired){
        Cache::put($cachename,$value,$expired/60);
        return false;
    }
698864
public function set($name, $value, $expire = null): bool
    {
        $this->writeTimes++;

        if (is_null($expire)) {
            $expire = $this->options['expire'];
        }

        if (!empty($this->tag) && !$this->has($name)) {
            $first = true;
        }

        $key    = $this->getCacheKey($name);
        $expire = $this->getExpireTime($expire);

        $value = $this->serialize($value);

        if ($expire) {
            $this->handler->setex($key, $expire, $value);
        } else {
            $this->handler->set($key, $value);
        }

        isset($first) && $this->setTagItem($key);

        return true;
    }
530601
public function replace($key, $value, $expiration = 0)
    {
        return $this->memcached ? $this->memcached->replace($key, $value, $expiration) : false;
    }
1311370
private <V> boolean isExpired(CacheValue<V> value) {
    long diff = ticker.read() - value.getCreationTime();
    return diff > maxEntryAgeNanos;
  }
186398
public function cache($context, string $key, $value = '', int $expire = 0)
    {
        if ($value === '') {
            $commandData = [$context, $key];
            $command = 'get';
        } else {
            if (!empty($expire)) {
                $command = 'setex';
                $commandData = [$context, $key, $expire, $value];
            } else {
                $command = 'set';
                $commandData = [$context, $key, $value];
            }
        }

        return $this->__call($command, $commandData);
    }
163337
function set($key, $value, $expire = 0)
    {
        if ($this->memcached)
        {
            return $this->cache->set($key, $value, $expire);
        }
        else
        {
            return $this->cache->set($key, $value, $this->flags, $expire);
        }
    }
1253697
public function add($key, $value, $expiration = null)
    {
        if (null !== $this->logger) {
            $this->logger->startMethod('add', ['key' => $key, 'value' => $value, 'expiration' => $expiration]);
        }

        if (!$this->assertConnected()) {
            $this->setResultFailed(5); // \Memcached::RES_WRITE_FAILURE
            $this->stopMethod();

            return false;
        }

        if (!$this->assertKey($key)) {
            $this->stopMethod();

            return false;
        }

        $key = $this->getPrefix().$key;
        $this->checkForDelayedDelete($key);
        if (!$this->assertHasNotInDeleteQueue($key)) {
            $this->setResultFailed(12); // \Memcached::RES_DATA_EXISTS doc states \Memcached::RES_NOTSTORED :(
            $this->stopMethod();

            return false;
        }

        if (!$this->assertHasNotInCache($key)) {
            $this->setResultFailed(12); // \Memcached::RES_DATA_EXISTS doc states \Memcached::RES_NOTSTORED :(
            $this->stopMethod();

            return false;
        }

        if (!$this->assertValue($value)) {
            $this->stopMethod();

            return false;
        }

        if (!$this->assertExpiration($expiration)) {
            $this->stopMethod();

            return false;
        }

        $this->storeValueInCache($key, $value, $expiration);
        $this->setResultOK();
        $this->stopMethod();

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

        return $this->handle->set($key, $value, $expire);
    }
918626
public function set(string $key, $value = null, int $expiration = 0) : bool
    {
        if (apcu_store($key, $value, $expiration)) {
            $this->updateMetaData($key, $expiration);
            $this->saveCacheListing();

            return true;
        }

        return false;
    }
438137
public function setString(string $value, int $expire = 0): bool
    {
        $handle = $this->handle;

        //覆盖并设置生存时间
        if ($expire) {
            return $handle->setex($this->name, $expire, $value);
        }

        //仅覆盖
        return $handle->set($this->name, $value);
    }
1186129
public function haveInMemcached($key, $value, $expiration = null)
    {
        switch (get_class($this->memcache)) {
            case 'Memcache':
                $this->assertTrue($this->memcache->set($key, $value, null, $expiration));
                break;
            case 'Memcached':
                $this->assertTrue($this->memcache->set($key, $value, $expiration));
                break;
        }
    }
518190
public function set($key, $value, $expire = 0)
    {
        if ($this->type === 1) {
            return $this->memcache->set($key, $value, $expire);
        } else {
            return $this->memcache->set($this->conf['prefix'] . $key, json_encode($value, JSON_UNESCAPED_UNICODE), false, $expire);
        }
    }
1113645
public function set($key, $value, $lifetime = 7200)
    {
        if (self::$cacheSetter) {
            return call_user_func_array(self::$cacheSetter, func_get_args());
        }

        $data = array(
                 'data'       => $value,
                 'expired_at' => time() + $lifetime - 500, //XXX: 微信API是世界上最烂的，没有之一
                );

        if (!file_put_contents($this->getCacheFile($key), serialize($data))) {
            throw new Exception('Access toekn 缓存失败');
        }
    }
1058410
public function set($name,$value,$expire=null) {
        N('cache_write',1);
        if(is_null($expire)) {
            $expire =  $this->options['expire'];
        }
        $filename   =   $this->filename($name);
        $data   =   serialize($value);
        if( C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
            //数据压缩
            $data   =   gzcompress($data,3);
        }
        if(C('DATA_CACHE_CHECK')) {//开启数据校验
            $check  =  md5($data);
        }else {
            $check  =  '';
        }
        $data    = "<?php\n//".sprintf('%012d',$expire).$check.$data."\n?>";
        $result  =   file_put_contents($filename,$data);
        if($result) {
            if($this->options['length']>0) {
                // 记录缓存队列
                $this->queue($name);
            }
            clearstatcache();
            return true;
        }else {
            return false;
        }
    }
362550
public static function set($name, $value, $expire = null){
        return self::driver()->set($name,$value,$expire);
    }
1047709
public function update($key, $value, $expire = 0)
    {
        if ($this->type === 1) {
            return $this->memcache->replace($key, $value, $expire);
        } else {
            return $this->memcache->replace($this->conf['prefix'] . $key, json_encode($value, JSON_UNESCAPED_UNICODE), false, $expire);
        }

    }
284473
public static function set($name, $value, $expired = null)
    {
        // 处理过期时间
        if (null === $expired)
        {
            $expired = Cookie::$expiration;
        }
        if ($expired !== 0)
        {
            $expired += time();
        }

        // Add the salt to the cookie value
        $value = Cookie::salt($name, $value) . '~' . $value;

        return Base::getHttp()->setCookie($name, $value, $expired, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httpOnly);
    }