|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / a / home / dev2.destoffenstraat.com / vendor / jms / metadata / src / Metadata / Cache / |
Filename | /home/a/home/dev2.destoffenstraat.com/vendor/jms/metadata/src/Metadata/Cache/PsrCacheAdapter.php |
Size | 1.19 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 21-Aug-2025 12:26 |
Last modified | 26-Oct-2018 14:40 |
Last accessed | 23-Aug-2025 00:36 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
namespace Metadata\Cache;
use Metadata\ClassMetadata;
use Psr\Cache\CacheItemPoolInterface;
class PsrCacheAdapter implements CacheInterface
{
private $prefix;
private $pool;
private $lastItem;
public function __construct($prefix, CacheItemPoolInterface $pool)
{
$this->prefix = $prefix;
$this->pool = $pool;
}
/**
* {@inheritDoc}
*/
public function loadClassMetadataFromCache(\ReflectionClass $class)
{
$this->lastItem = $this->pool->getItem(strtr($this->prefix . $class->name, '\\', '.'));
return $this->lastItem->get();
}
/**
* {@inheritDoc}
*/
public function putClassMetadataInCache(ClassMetadata $metadata)
{
$key = strtr($this->prefix . $metadata->name, '\\', '.');
if (null === $this->lastItem || $this->lastItem->getKey() !== $key) {
$this->lastItem = $this->pool->getItem($key);
}
$this->pool->save($this->lastItem->set($metadata));
}
/**
* {@inheritDoc}
*/
public function evictClassMetadataFromCache(\ReflectionClass $class)
{
$this->pool->deleteItem(strtr($this->prefix . $class->name, '\\', '.'));
}
}
namespace Metadata\Cache;
use Metadata\ClassMetadata;
use Psr\Cache\CacheItemPoolInterface;
class PsrCacheAdapter implements CacheInterface
{
private $prefix;
private $pool;
private $lastItem;
public function __construct($prefix, CacheItemPoolInterface $pool)
{
$this->prefix = $prefix;
$this->pool = $pool;
}
/**
* {@inheritDoc}
*/
public function loadClassMetadataFromCache(\ReflectionClass $class)
{
$this->lastItem = $this->pool->getItem(strtr($this->prefix . $class->name, '\\', '.'));
return $this->lastItem->get();
}
/**
* {@inheritDoc}
*/
public function putClassMetadataInCache(ClassMetadata $metadata)
{
$key = strtr($this->prefix . $metadata->name, '\\', '.');
if (null === $this->lastItem || $this->lastItem->getKey() !== $key) {
$this->lastItem = $this->pool->getItem($key);
}
$this->pool->save($this->lastItem->set($metadata));
}
/**
* {@inheritDoc}
*/
public function evictClassMetadataFromCache(\ReflectionClass $class)
{
$this->pool->deleteItem(strtr($this->prefix . $class->name, '\\', '.'));
}
}