for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Metadata\Cache;
use Metadata\ClassMetadata;
use Psr\Cache\CacheItemPoolInterface;
class PsrCacheAdapter implements CacheInterface
{
private $prefix;
private $pool;
private $lastItem;
public function __construct(string $prefix, CacheItemPoolInterface $pool)
$this->prefix = $prefix;
$this->pool = $pool;
}
/**
* {@inheritDoc}
*/
public function load(string $class): ?ClassMetadata
$this->lastItem = $this->pool->getItem(strtr($this->prefix . $class, '\\', '.'));
return $this->lastItem->get();
public function put(ClassMetadata $metadata): void
$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));
public function evict(string $class): void
$this->pool->deleteItem(strtr($this->prefix . $class, '\\', '.'));