namespace Friendica\Core\Cache;
-use Friendica\Core\Cache;
use Friendica\Core\System;
use Friendica\Util\Profiler;
*
* It is using the decorator pattern (@see
*/
-class ProfilerCache implements ICacheDriver, IMemoryCacheDriver
+class ProfilerCache implements ICache, IMemoryCache
{
/**
- * @var ICacheDriver The original cache driver
+ * @var ICache The original cache driver
*/
private $cache;
*/
private $profiler;
- public function __construct(ICacheDriver $cache, Profiler $profiler)
+ public function __construct(ICache $cache, Profiler $profiler)
{
$this->cache = $cache;
$this->profiler = $profiler;
*/
public function add($key, $value, $ttl = Cache::FIVE_MINUTES)
{
- if ($this->cache instanceof IMemoryCacheDriver) {
+ if ($this->cache instanceof IMemoryCache) {
$time = microtime(true);
$return = $this->cache->add($key, $value, $ttl);
*/
public function compareSet($key, $oldValue, $newValue, $ttl = Cache::FIVE_MINUTES)
{
- if ($this->cache instanceof IMemoryCacheDriver) {
+ if ($this->cache instanceof IMemoryCache) {
$time = microtime(true);
$return = $this->cache->compareSet($key, $oldValue, $newValue, $ttl);
*/
public function compareDelete($key, $value)
{
- if ($this->cache instanceof IMemoryCacheDriver) {
+ if ($this->cache instanceof IMemoryCache) {
$time = microtime(true);
$return = $this->cache->compareDelete($key, $value);
return false;
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function GetName()
+ {
+ return $this->cache->getName() . ' (with profiler)';
+ }
}