批量设置缓存

@param array $data 要设置的缓存,键为缓存的Key
@param int $expire 有效期, 0为不过期
@return bool Key到值的Map
162667
public function setMultiple($data, $expire = 0)
    {
        if (!is_array($data)) {
            throw new InvalidArgumentException(sprintf('Cache keys must be array, "%s" given', is_object($data) ? get_class($data) : gettype($data)));
        }

        foreach ($data as &$d) {
            if (!is_numeric($d)) {
                $d = json_encode($d);
            }
        }

        $retFlag = $this->redis->mset($data);
        if ($expire > 0) {
            foreach ($data as $key => $value) {
                $this->redis->expire($key, $expire);
            }
        }

        return $retFlag;
    }
1308219
public function set($key, $value, $expire = 600) {
        $this->redis->setex($this->formatKey($key), $expire, $this->formatValue($value));
    }
316664
public function get($key, $expiration = false)
    {
        $item = $this->psr6Cache->getItem($key);

        return $item->isHit() ? $item->get() : false;
    }
1198427
public function toExt($data, $key = null, $array = false)
	{
		return $this->to(self::EXT, $data, $key, $array);
	}
138516
private function pack($data, $expire)
    {

        if ($data === '') {
            return '';
        }

        $cookie_data = array();
        $cookie_data['value'] = $data;
        $cookie_data['expire'] = $expire;
        return json_encode($cookie_data);
    }
1281180
protected function doSet(string $srcKey, $data, int $expire = 0): bool
    {
        $func = self::$type . '_store';
        $func($srcKey, $data, $expire);
        return true;
    }
684569
public function set($key, $data, $expire = 0, $compress=false) {
		$expire = intval($expire);
		return $this->cache->set($this->prefix.$key, $data, $compress ? MEMCACHE_COMPRESSED : 0, $expire);
	}
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);
        }
    }
1345170
public function expires($expires = null)
    {
        if (func_num_args() === 0) {
            return (integer) $this->_data['expires'];
        }
        if ($expires === null) {
            return $this->_data['expires'] = null;
        }
        if (static::isValidTimeStamp($expires)) {
            return $this->_data['expires'] = $expires;
        }

        $this->_data['expires'] = strtotime($expires);
        return $this->_data['expires'] = (integer) $this->_data['expires'];
    }
667163
public function setExpire($expire)
    {
        if (!$expire instanceof DateTime) {
            if (is_integer($expire)) {
                $expire = (new DateTime())->setTimestamp($expire);
            } else {
                $expire = new DateTime($expire);
            }
        }
        $this->expire = $expire;

        return $this;
    }
198744
private function packData($data, $expires)
    {
        $str            = [];
        $str['data']    = $data;
        $str['expires'] = $expires === 0 ? 0 : time() + $expires;
        $str            = serialize($str);

        return $str;
    }
1110920
public function set($key, $value, $expire = 0)
    {
        $this->front->set($key, $value, $expire);
        return $this->back->set($key, $value, $expire);
    }
694969
protected function saveAccessToken($token, $expire)
    {
        $data   = ['token' => $token, 'expire' => intval($expire), 'time' => time()];
        return ($this->getFileSystem()->put($this->getTokenFilePath(), json_encode($data), true) > 0);
    }
610284
public function setMultiple($data, $expire = 0)
    {
        if (!is_array($data)) {
            throw new InvalidArgumentException(sprintf('Cache data must be array, "%s" given', is_object($data) ? get_class($data) : gettype($data)));
        }

        return $this->setMulti($data, $expire);
    }
412543
public static function list(string $name, ?array $values = null, int $expire = 0): RedisList
    {
        //创建对象
        $list = new RedisList(self::handle(), $name);

        //如果指定了值,则添加
        if (!is_null($values)) {
            $list->inserts($values);
        }

        //设置过期时间
        $list->setExpire($expire);

        //返回List对象
        return $list;
    }
25207
public function set($key, $val, $expire = 0)
    {
        return $this->mem->set($key, $val, $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);
        }

    }