Files
pull-courseware/vendor/kevinrob/guzzle-cache-middleware/src/Storage/Psr16CacheStorage.php
T
julecn 9bab04be20 chore: 批量修改文件权限为可执行
将项目内绝大多数文件的权限从644调整为755,统一可执行权限配置
2026-08-02 16:29:01 +08:00

53 lines
973 B
PHP
Executable File

<?php
namespace Kevinrob\GuzzleCache\Storage;
use Kevinrob\GuzzleCache\CacheEntry;
use Psr\SimpleCache\CacheInterface;
class Psr16CacheStorage implements CacheStorageInterface
{
/**
* @var CacheInterface
*/
private $cache;
public function __construct(CacheInterface $cache)
{
$this->cache = $cache;
}
/**
* {@inheritdoc}
*/
public function fetch($key)
{
$data = $this->cache->get($key);
if ($data instanceof CacheEntry) {
return $data;
}
return null;
}
/**
* {@inheritdoc}
*/
public function save($key, CacheEntry $data)
{
$ttl = $data->getTTL();
if ($ttl === 0) {
return $this->cache->set($key, $data);
}
return $this->cache->set($key, $data, $data->getTTL());
}
/**
* {@inheritdoc}
*/
public function delete($key)
{
return $this->cache->delete($key);
}
}