]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Cache/ProfilerCache.php
Renamed __toString() to getName()
[friendica.git] / src / Core / Cache / ProfilerCache.php
index 04271e7c69a2323dc6d54570557d3208a28be987..d59b885609d6947766c8fceb216dd8d8cfd49df6 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Friendica\Core\Cache;
 
-use Friendica\Core\Cache;
 use Friendica\Core\System;
 use Friendica\Util\Profiler;
 
@@ -11,10 +10,10 @@ 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;
 
@@ -23,7 +22,7 @@ class ProfilerCache implements ICacheDriver, IMemoryCacheDriver
         */
        private $profiler;
 
-       public function __construct(ICacheDriver $cache, Profiler $profiler)
+       public function __construct(ICache $cache, Profiler $profiler)
        {
                $this->cache    = $cache;
                $this->profiler = $profiler;
@@ -104,7 +103,7 @@ class ProfilerCache implements ICacheDriver, IMemoryCacheDriver
         */
        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);
@@ -122,7 +121,7 @@ class ProfilerCache implements ICacheDriver, IMemoryCacheDriver
         */
        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);
@@ -140,7 +139,7 @@ class ProfilerCache implements ICacheDriver, IMemoryCacheDriver
         */
        public function compareDelete($key, $value)
        {
-               if ($this->cache instanceof IMemoryCacheDriver) {
+               if ($this->cache instanceof IMemoryCache) {
                        $time = microtime(true);
 
                        $return = $this->cache->compareDelete($key, $value);
@@ -152,4 +151,12 @@ class ProfilerCache implements ICacheDriver, IMemoryCacheDriver
                        return false;
                }
        }
+
+       /**
+        * {@inheritDoc}
+        */
+       public function GetName()
+       {
+               return $this->cache->getName() . ' (with profiler)';
+       }
 }