for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Genkgo\Cache\Adapter;
use Genkgo\Cache\CacheAdapterInterface;
/**
* Class NamespaceAdapter
* @package Genkgo\Cache
*/
class NamespaceAdapter implements CacheAdapterInterface
{
* @var CacheAdapterInterface
private $cache;
* @var string
private $nsName;
private $separator;
* @param CacheAdapterInterface $cache
* @param $nsName
* @param string $separator
public function __construct(CacheAdapterInterface $cache, $nsName, $separator = '.')
$this->cache = $cache;
$this->nsName = $nsName;
$this->separator = $separator;
}
* @param $key
* @return mixed|null
public function get($key)
return $this->cache->get($this->getKey($key));
* @param $value
public function set($key, $value)
$this->cache->set($this->getKey($key), $value);
public function delete($key)
$this->cache->delete($this->getKey($key));
* @return string
private function getKey($key)
return $this->nsName . $this->separator . $key;