创建一个Int存储对象
@param $name string Redis存储对象的名称
@param int $value 值
@param int $expire 生存期
@return RedisInt
186438
public static function int(string $name, ?int $value = null, int $expire = 0): RedisInt
    {
        $int = new RedisInt(self::handle(), $name);

        if (!is_null($value)) {
            $int->set($value, $expire);
        }
        return $int;
    }
643976
public function replace($key, $value, $expire = 0)
    {
        if (false === $this->get($key)) {
            return false;
        }
        return $this->set($key, $value, $expire);
    }
259490
public function set($key, $value, $expiration = 0)
    {
        $key = $this->createKey($key);
        $this->instance->set($key, $value, $expiration);
        return $this;
    }
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;
    }
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);
        }

    }
1215778
public static function set(string $key, $value, int $expire = null): bool
    {
        return self::storage()->set($key, $value, $expire);
    }
1259513
protected function appendValue($key, $value, $expiration = 0)
    {
        if ($this->redis->exists($key)) {
            $this->redis->append($key, $value);

            return $this->redis->expire($key, $expiration);
        }

        return $this->redis->setex($key, $expiration, $value);
    }
348219
public function setValAndExpire($key, $value, $expire = 86400) {
		ini_set('session.gc_maxlifetime', $expire);
		session_set_cookie_params($expire);
		if(!isset($_SESSION)){
			session_start();
		}
		$_SESSION[$key] = $value;
	}
594413
function set($key, $value, $expire = 0)
    {
        // 如果是对象，需要进行序列号存储
        if (is_array($value) || is_object($value)) {
            $value = serialize($value);
        }

        if ($expire > 0) {
            return $this->connection->setex($key, $expire, $value);
        } else {
            return $this->connection->set($key, $value);
        }
    }
1355160
public function setBin(string $value, int $expire = 0): bool
    {
        return $this->setRaw(pack('H*', base_convert($value, 2, 16)), $expire);
    }
34492
public function cache($key, $value, $expire = null)
    {
        $this->_caches[$key] = $value;
        return true;
    }
287171
public function setBytes(array $value, int $expire = 0): bool
    {
        return $this->setRaw(pack('C*', $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;
    }
866549
public function set($name, $value,$expire=null) {
        $data   =  serialize($value);
        $name   =  $this->options['prefix'].addslashes($name);
        N('cache_write',1);
        if( C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
            //数据压缩
            $data   =   gzcompress($data,3);
        }
        if(C('DATA_CACHE_CHECK')) {//开启数据校验
            $crc  =  md5($data);
        }else {
            $crc  =  '';
        }
        if(is_null($expire)) {
            $expire  =  $this->options['expire'];
        }
        $expire	    =   ($expire==0)?0: (time()+$expire) ;//缓存有效期为0表示永久缓存
        $result     =   $this->handler->query('select `cachekey` from `'.$this->options['table'].'` where `cachekey`=\''.$name.'\' limit 0,1');
        if(!empty($result) ) {
        	//更新记录
            $result  =  $this->handler->execute('UPDATE '.$this->options['table'].' SET data=\''.$data.'\' ,datacrc=\''.$crc.'\',expire='.$expire.' WHERE `cachekey`=\''.$name.'\'');
        }else {
        	//新增记录
             $result  =  $this->handler->execute('INSERT INTO '.$this->options['table'].' (`cachekey`,`data`,`datacrc`,`expire`) VALUES (\''.$name.'\',\''.$data.'\',\''.$crc.'\','.$expire.')');
        }
        if($result) {
            if($this->options['length']>0) {
                // 记录缓存队列
                $this->queue($name);
            }
            return true;
        }else {
            return false;
        }
    }
623775
public function setResponseCookie($response, $name, $value = null, $expiration = 0)
    {
        $expiration = 1;
        if ($expiration == 0) {
            $expiration = 30;
        }
        if (is_numeric($expiration)) {
            $expiration = $expiration;
        }

        $response = FigResponseCookies::set(
            $response,
            SetCookie::create($name)
            ->withExpires(Carbon::parse()->timestamp + 60*60*24*$expiration)
            ->withValue($value)
        );

        return $response;
    }
941394
public function set($name, $value, $ttl = 0){

		$name = trim($name);

		if($name == ''){

			throw new CacheException('Cache-entry name cannot be empty');
		}

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

		if(is_resource($value)){

			throw new CacheException('Cannot cache values of type "resource"');
		}

		if(!$this->validateValueSize($value)){

			ExceptionHandler::notice("Value in $name is too big to be stored in memcache.");
		}

		// A 30 day+ TTL is interpreted as a timestamp by memcached

		if($ttl > 2592000){

			$ttl = time() + $ttl;
		}

		// Name cannot be longer than 250 characters

		assert('strlen($name) <= 250');
		if(strlen($name) > 250) return false;

		$result = $this->_Memcache->set($name, $value, 0, $ttl);

		if($result === false && !Memcache::isConnected($this->_Memcache)){

			throw new CacheException("Failed to set '$name', Memcache appears
				to be disconnected!?");
		}

		return $result;
	}
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);
	}