vendor/maximebf/debugbar/src/DebugBar/Storage/RedisStorage.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/*
* This file is part of the DebugBar package.
*
* (c) 2013 Maxime Bouroumeau-Fuseau
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace DebugBar\Storage;
/**
* Stores collected data into Redis
*/
class RedisStorage implements StorageInterface
{
/** @var \Predis\Client|\Redis */
protected $redis;
/** @var string */
protected $hash;
/**
* @param \Predis\Client|\Redis $redis Redis Client
* @param string $hash
*/
public function __construct($redis, $hash = 'phpdebugbar')
{
$this->redis = $redis;
$this->hash = $hash;
}
/**
* {@inheritdoc}
*/
public function save($id, $data)
{
$this->redis->hSet("$this->hash:meta", $id, serialize($data['__meta']));
unset($data['__meta']);
$this->redis->hSet("$this->hash:data", $id, serialize($data));
}
/**
* {@inheritdoc}
*/
public function get($id)
{
return array_merge(unserialize($this->redis->hGet("$this->hash:data", $id)),
array('__meta' => unserialize($this->redis->hGet("$this->hash:meta", $id))));
}
/**
* {@inheritdoc}
*/
public function find(array $filters = [], $max = 20, $offset = 0)
{
$results = [];
$cursor = "0";
$isPhpRedis = get_class($this->redis) === 'Redis';
后面还有 46 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
