vendor/maximebf/debugbar/src/DebugBar/Storage/MemcachedStorage.php
(开头部分) 4KB这里只显示每个文件的开头 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;
use Memcached;
use ReflectionMethod;
/**
* Stores collected data into Memcache using the Memcached extension
*/
class MemcachedStorage implements StorageInterface
{
protected $memcached;
protected $keyNamespace;
protected $expiration;
protected $newGetMultiSignature;
/**
* @param Memcached $memcached
* @param string $keyNamespace Namespace for Memcached key names (to avoid conflict with other Memcached users).
* @param int $expiration Expiration for Memcached entries (see Expiration Times in Memcached documentation).
*/
public function __construct(Memcached $memcached, $keyNamespace = 'phpdebugbar', $expiration = 0)
{
$this->memcached = $memcached;
$this->keyNamespace = $keyNamespace;
$this->expiration = $expiration;
}
/**
* {@inheritdoc}
*/
public function save($id, $data)
{
$key = $this->createKey($id);
$this->memcached->set($key, $data, $this->expiration);
if (!$this->memcached->append($this->keyNamespace, "|$key")) {
$this->memcached->set($this->keyNamespace, $key, $this->expiration);
} else if ($this->expiration) {
// append doesn't support updating expiration, so do it here:
$this->memcached->touch($this->keyNamespace, $this->expiration);
}
}
/**
* {@inheritdoc}
*/
public function get($id)
{
后面还有 98 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
