写入缓存
@access public
@param string $name 缓存变量名
@param mixed $value 存储数据
@param integer $expire 有效时间（秒）
@return bool
496559
public function set($name, $value, $expire = null) {
        if (is_null($expire)) {
            $expire = $this->options['expire'];
        }
        //if ($this->tag && !$this->has($name)) {
        //    $first = true;
        //}
        //$key = $this->getCacheKey($name);
        $expire = 0 == $expire ? 0 : $_SERVER['REQUEST_TIME'] + $expire;
        if ($this->handler->set($name, $value, $expire)) {
            //isset($first) && $this->setTagItem($name);
            return true;
        }
        return false;
    }
143567
public function set($name, $value, $expire = null): bool
    {
        $this->writeTimes++;

        $name = $this->getCacheKey($name);

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

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

        if ($expire instanceof \DateTime) {
            $expire = $expire->getTimestamp();
        } else {
            $expire = (0 == $expire) ? 0 : (time() + $expire); //缓存有效期为0表示永久缓存
        }

        if (function_exists('gzcompress')) {
            //数据压缩
            $value = gzcompress($value, 3);
        }

        if (!empty($this->tag)) {
            $tag       = current($this->tag);
            $this->tag = null;
        } else {
            $tag = '';
        }

        $sql = 'REPLACE INTO ' . $this->options['table'] . ' (var, value, expire, tag) VALUES (\'' . $name . '\', \'' . $value . '\', \'' . $expire . '\', \'' . $tag . '\')';

        if (sqlite_query($this->handler, $sql)) {
            return true;
        }

        return false;
    }
768786
public static function cookie($name, $value = null, $expire = null, $path = null, $domain = null, $security = null) {
        $settings       = App::cfg();
        $cookie_setting = array_merge2([
            'expire'   => 0,
            'path'     => '/',
            'domain'   => '',
            'security' => false
        ], $settings->get('cookie', []));
        if ($expire == null) {
            $expire = intval($cookie_setting ['expire']);
        }
        if ($path == null) {
            $path = $cookie_setting ['path'];
        }
        if ($domain == null) {
            $domain = $cookie_setting ['domain'];
        }
        if ($security == null) {
            $security = $cookie_setting ['security'];
        }
        if ($expire != 0) {
            $expire = time() + $expire;
        }
        @setcookie($name, $value, $expire, $path, $domain, $security);
    }
547239
public function set($key, $value, $expire = null)
    {
        if (null === $expire) {
            $expire = $this->_expire;
        }
        return $this->_mc->set($key, $value, 0, $expire);
    }
785723
public function setRaw(string $value, int $expire = 0): bool
    {
        return parent::setString($value, $expire);
    }
224755
public function update($key, $value, $expire = 0)
    {
        $arr = $this->get($key);
        if (!empty($arr)) {
            $arr = array_merge($arr, $value);
            return $this->set($key, $arr, $expire);
        }
        return 0;
    }
997479
public function setCookie($name, $value = null, $expire = null, $path = '/', $domain = '', $secure = false, $httponly = false){
        if(!$this->isEndResponse()){
            $this->withAddedCookie([
                $name,$value,$expire,$path,$domain,$secure,$httponly
            ]);
            return true;
        }else{
            return false;
        }

    }
314316
protected function setCookie($name, $value, $expire, $option = [])
    {
        WorkerHttp::setCookie($name, $value, $expire, $option['path'], $option['domain'], $option['secure'], $option['httponly']);
    }
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);
        }
    }
1057558
public function set(
        $name = '',
        $value = '',
        $expire = 0,
        $path = '/',
        $domain = '',
        $secure = false,
        $httpOnly = false
    ) {
        if (empty($value)) {
            Craft::$app->response->cookies->remove($name);
        } else {
            $domain = empty($domain) ? Craft::$app->getConfig()->getGeneral()->defaultCookieDomain : $domain;
            $expire = (int)$expire;
            setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
            $_COOKIE[$name] = $value;
        }
    }
1240394
public static function update($name,array $data, $expire = null) {
        return self::driver()->update($name,$data, $expire);
    }
750880
private function cookie($name, $value = null, $expire = 0, $domain = '', $path = '/', $secure = false)
    {
        if($value === false) {
            \Yii::$app->response->cookies->remove($name);
        } elseif($value === null) {
            return \Yii::$app->request->cookies->getValue($name);
        }

        /*$options['name'] = $name;
        $options['value'] = $value;
        $options['expire'] = $expire; //$expire?:time()+86400*365
        $options['domain'] = $domain;
        $options['path'] = $path;
        $options['secure'] = $secure;
        $cookie = new \yii\web\Cookie($options);
        \Yii::$app->response->cookies->add($cookie);*/
    }
56799
public function _set($name, $value, $expires)
    {
        $name = $this->createFileName($name);
        $data = $this->packData($value);
        if ($expires === 0) {
            return $this->redis->set($name, $data);
        }

        return $this->redis->setex($name, $expires, $data);
    }
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);
        }

    }
262119
public static function set($name, $value, $expire = 0, $path = '/', $domain = '', $secure = '')
	{
		if(!self::$isInit)
		{
			self::init();
		}
		return setcookie($name, $value, is_numeric($expire) ? $expire : self::$expire, '' == $path ? self::$path : $path, '' == $domain ? self::$domain : $domain, '' == $secure ? self::$secure : $secure);
	}
238444
public function setSecret($name, $value, $expire = 604800, $path = '/', $domain = '')
    {
        $value = \ePHP\Hash\Encrypt::encryptG($value, md5($_SERVER['HTTP_HOST'].APP_PATH.SERVER_MODE));
        $this->set($name, $value, $expire, $path, $domain);
    }
1037541
public function set($key, $value, $expire = 0)
    {
        $value = '<?php exit;?>' . time() . "($expire)" . serialize($value);

        if ($this->lock) {//自增自减
            fseek($this->lock, 0);
            $return = fwrite($this->lock, $value);
            flock($this->lock, LOCK_UN);
            fclose($this->lock);
            $this->lock = false;
        } else {
            $fileName = $this->getFileName($key);
            $return = file_put_contents($fileName, $value, LOCK_EX);
        }
        $return && clearstatcache();
        return $return;
    }