]> git.mxchange.org Git - friendica.git/commitdiff
- Move constants to the "Cache" class (more transparent than inside the interface)
authorPhilipp Holzer <admin+github@philipp.info>
Sun, 4 Aug 2019 13:51:49 +0000 (15:51 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Sun, 4 Aug 2019 13:53:28 +0000 (15:53 +0200)
20 files changed:
src/Core/Cache.php
src/Core/Cache/APCuCache.php
src/Core/Cache/AbstractCache.php [deleted file]
src/Core/Cache/ArrayCache.php
src/Core/Cache/Cache.php [new file with mode: 0644]
src/Core/Cache/DatabaseCache.php
src/Core/Cache/ICache.php
src/Core/Cache/MemcacheCache.php
src/Core/Cache/MemcachedCache.php
src/Core/Cache/ProfilerCache.php
src/Core/Cache/RedisCache.php
src/Core/Cache/TraitCompareDelete.php
src/Core/Cache/TraitCompareSet.php
src/Core/Lock/AbstractLock.php [deleted file]
src/Core/Lock/CacheLock.php
src/Core/Lock/DatabaseLock.php
src/Core/Lock/Lock.php [new file with mode: 0644]
src/Core/Lock/SemaphoreLock.php
src/Factory/CacheFactory.php
src/Factory/LockFactory.php

index e469dcba1089115c101a6409bd5d44642c5bc372..7a952ff8a14a8149875bada999f778676adca4d2 100644 (file)
@@ -5,6 +5,7 @@
 namespace Friendica\Core;
 
 use Friendica\BaseObject;
+use Friendica\Core\Cache\Cache as CacheClass;
 use Friendica\Core\Cache\ICache;
 
 /**
@@ -12,24 +13,24 @@ use Friendica\Core\Cache\ICache;
  */
 class Cache extends BaseObject
 {
-       /** @deprecated Use ICache::MONTH */
-       const MONTH        = ICache::MONTH;
-       /** @deprecated Use ICache::WEEK */
-       const WEEK         = ICache::WEEK;
-       /** @deprecated Use ICache::DAY */
-       const DAY          = ICache::DAY;
-       /** @deprecated Use ICache::HOUR */
-       const HOUR         = ICache::HOUR;
-       /** @deprecated Use ICache::HALF_HOUR */
-       const HALF_HOUR    = ICache::HALF_HOUR;
-       /** @deprecated Use ICache::QUARTER_HOUR */
-       const QUARTER_HOUR = ICache::QUARTER_HOUR;
-       /** @deprecated Use ICache::FIVE_MINUTES */
-       const FIVE_MINUTES = ICache::FIVE_MINUTES;
-       /** @deprecated Use ICache::MINUTE */
-       const MINUTE       = ICache::MINUTE;
-       /** @deprecated Use ICache::INFINITE */
-       const INFINITE     = ICache::INFINITE;
+       /** @deprecated Use CacheClass::MONTH */
+       const MONTH        = CacheClass::MONTH;
+       /** @deprecated Use CacheClass::WEEK */
+       const WEEK         = CacheClass::WEEK;
+       /** @deprecated Use CacheClass::DAY */
+       const DAY          = CacheClass::DAY;
+       /** @deprecated Use CacheClass::HOUR */
+       const HOUR         = CacheClass::HOUR;
+       /** @deprecated Use CacheClass::HALF_HOUR */
+       const HALF_HOUR    = CacheClass::HALF_HOUR;
+       /** @deprecated Use CacheClass::QUARTER_HOUR */
+       const QUARTER_HOUR = CacheClass::QUARTER_HOUR;
+       /** @deprecated Use CacheClass::FIVE_MINUTES */
+       const FIVE_MINUTES = CacheClass::FIVE_MINUTES;
+       /** @deprecated Use CacheClass::MINUTE */
+       const MINUTE       = CacheClass::MINUTE;
+       /** @deprecated Use CacheClass::INFINITE */
+       const INFINITE     = CacheClass::INFINITE;
 
        /**
         * @brief Returns all the cache keys sorted alphabetically
@@ -69,7 +70,7 @@ class Cache extends BaseObject
         * @return bool
         * @throws \Exception
         */
-       public static function set($key, $value, $duration = ICache::MONTH)
+       public static function set($key, $value, $duration = CacheClass::MONTH)
        {
                return self::getClass(ICache::class)->set($key, $value, $duration);
        }
index eb879590e79cfe58db79b134865367b8bdf05240..9afbf05c46783cbd31961ff80149a34d1c73f744 100644 (file)
@@ -3,14 +3,13 @@
 namespace Friendica\Core\Cache;
 
 use Exception;
-use Friendica\Core\Cache;
 
 /**
  * APCu Cache.
  *
  * @author Philipp Holzer <admin@philipp.info>
  */
-class APCuCache extends AbstractCache implements IMemoryCache
+class APCuCache extends Cache implements IMemoryCache
 {
        use TraitCompareSet;
        use TraitCompareDelete;
diff --git a/src/Core/Cache/AbstractCache.php b/src/Core/Cache/AbstractCache.php
deleted file mode 100644 (file)
index c1cd964..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-namespace Friendica\Core\Cache;
-
-/**
- * Abstract class for common used functions
- *
- * Class AbstractCache
- *
- * @package Friendica\Core\Cache
- */
-abstract class AbstractCache implements ICache
-{
-       const TYPE_APCU      = 'apcu';
-       const TYPE_ARRAY     = 'array';
-       const TYPE_DATABASE  = 'database';
-       const TYPE_MEMCACHE  = 'memcache';
-       const TYPE_MEMCACHED = 'memcached';
-       const TYPE_REDIS     = 'redis';
-
-       /**
-        * Force each Cache implementation to define the ToString method
-        *
-        * @return string
-        */
-       abstract function __toString();
-
-       /**
-        * @var string The hostname
-        */
-       private $hostName;
-
-       public function __construct(string $hostName)
-       {
-               $this->hostName = $hostName;
-       }
-
-       /**
-        * Returns the prefix (to avoid namespace conflicts)
-        *
-        * @return string
-        * @throws \Exception
-        */
-       protected function getPrefix()
-       {
-               // We fetch with the hostname as key to avoid problems with other applications
-               return $this->hostName;
-       }
-
-       /**
-        * @param string $key The original key
-        * @return string        The cache key used for the cache
-        * @throws \Exception
-        */
-       protected function getCacheKey($key)
-       {
-               return $this->getPrefix() . ":" . $key;
-       }
-
-       /**
-        * @param array $keys   A list of cached keys
-        * @return array        A list of original keys
-        */
-       protected function getOriginalKeys($keys)
-       {
-               if (empty($keys)) {
-                       return [];
-               } else {
-                       // Keys are prefixed with the node hostname, let's remove it
-                       array_walk($keys, function (&$value) {
-                               $value = preg_replace('/^' . $this->hostName . ':/', '', $value);
-                       });
-
-                       sort($keys);
-
-                       return $keys;
-               }
-       }
-
-       /**
-        * Filters the keys of an array with a given prefix
-        * Returns the filtered keys as an new array
-        *
-        * @param array $array The array, which should get filtered
-        * @param string|null $prefix The prefix (if null, all keys will get returned)
-        *
-        * @return array The filtered array with just the keys
-        */
-       protected function filterArrayKeysByPrefix($array, $prefix = null)
-       {
-               if (empty($prefix)) {
-                       return array_keys($array);
-               } else {
-                       $result = [];
-
-                       foreach (array_keys($array) as $key) {
-                               if (strpos($key, $prefix) === 0) {
-                                       array_push($result, $key);
-                               }
-                       }
-
-                       return $result;
-               }
-       }
-}
index 451fec363d1d0684b5943f52bb312dedaa90803c..17fbe2f407ddcf2e1650989977e83d1d68214bf4 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace Friendica\Core\Cache;
 
-use Friendica\Core\Cache;
-
 /**
  * Implementation of the IMemoryCache mainly for testing purpose
  *
@@ -11,7 +9,7 @@ use Friendica\Core\Cache;
  *
  * @package Friendica\Core\Cache
  */
-class ArrayCache extends AbstractCache implements IMemoryCache
+class ArrayCache extends Cache implements IMemoryCache
 {
        use TraitCompareDelete;
 
diff --git a/src/Core/Cache/Cache.php b/src/Core/Cache/Cache.php
new file mode 100644 (file)
index 0000000..4e24246
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+
+namespace Friendica\Core\Cache;
+
+/**
+ * Abstract class for common used functions
+ *
+ * Class AbstractCache
+ *
+ * @package Friendica\Core\Cache
+ */
+abstract class Cache implements ICache
+{
+       const TYPE_APCU      = 'apcu';
+       const TYPE_ARRAY     = 'array';
+       const TYPE_DATABASE  = 'database';
+       const TYPE_MEMCACHE  = 'memcache';
+       const TYPE_MEMCACHED = 'memcached';
+       const TYPE_REDIS     = 'redis';
+
+       const MONTH        = 2592000;
+       const WEEK         = 604800;
+       const DAY          = 86400;
+       const HOUR         = 3600;
+       const HALF_HOUR    = 1800;
+       const QUARTER_HOUR = 900;
+       const FIVE_MINUTES = 300;
+       const MINUTE       = 60;
+       const INFINITE     = 0;
+
+       /**
+        * Force each Cache implementation to define the ToString method
+        *
+        * @return string
+        */
+       abstract function __toString();
+
+       /**
+        * @var string The hostname
+        */
+       private $hostName;
+
+       public function __construct(string $hostName)
+       {
+               $this->hostName = $hostName;
+       }
+
+       /**
+        * Returns the prefix (to avoid namespace conflicts)
+        *
+        * @return string
+        * @throws \Exception
+        */
+       protected function getPrefix()
+       {
+               // We fetch with the hostname as key to avoid problems with other applications
+               return $this->hostName;
+       }
+
+       /**
+        * @param string $key The original key
+        * @return string        The cache key used for the cache
+        * @throws \Exception
+        */
+       protected function getCacheKey($key)
+       {
+               return $this->getPrefix() . ":" . $key;
+       }
+
+       /**
+        * @param array $keys   A list of cached keys
+        * @return array        A list of original keys
+        */
+       protected function getOriginalKeys($keys)
+       {
+               if (empty($keys)) {
+                       return [];
+               } else {
+                       // Keys are prefixed with the node hostname, let's remove it
+                       array_walk($keys, function (&$value) {
+                               $value = preg_replace('/^' . $this->hostName . ':/', '', $value);
+                       });
+
+                       sort($keys);
+
+                       return $keys;
+               }
+       }
+
+       /**
+        * Filters the keys of an array with a given prefix
+        * Returns the filtered keys as an new array
+        *
+        * @param array $array The array, which should get filtered
+        * @param string|null $prefix The prefix (if null, all keys will get returned)
+        *
+        * @return array The filtered array with just the keys
+        */
+       protected function filterArrayKeysByPrefix($array, $prefix = null)
+       {
+               if (empty($prefix)) {
+                       return array_keys($array);
+               } else {
+                       $result = [];
+
+                       foreach (array_keys($array) as $key) {
+                               if (strpos($key, $prefix) === 0) {
+                                       array_push($result, $key);
+                               }
+                       }
+
+                       return $result;
+               }
+       }
+}
index 42f40ab1ed693d8b4a69bff5196aee37e183efb2..e0e371fe5ad10aa609b339ba1673127befad2b90 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Friendica\Core\Cache;
 
-use Friendica\Core\Cache;
 use Friendica\Database\Database;
 use Friendica\Util\DateTimeFormat;
 
@@ -11,7 +10,7 @@ use Friendica\Util\DateTimeFormat;
  *
  * @author Hypolite Petovan <hypolite@mrpetovan.com>
  */
-class DatabaseCache extends AbstractCache implements ICache
+class DatabaseCache extends Cache implements ICache
 {
        /**
         * @var Database
index f57e105cc0ab880737ef238c3d9f55ad689b6858..1ff6a8c52de5b8558c254b32265a2a503c8ba9aa 100644 (file)
@@ -9,16 +9,6 @@ namespace Friendica\Core\Cache;
  */
 interface ICache
 {
-       const MONTH        = 2592000;
-       const WEEK         = 604800;
-       const DAY          = 86400;
-       const HOUR         = 3600;
-       const HALF_HOUR    = 1800;
-       const QUARTER_HOUR = 900;
-       const FIVE_MINUTES = 300;
-       const MINUTE       = 60;
-       const INFINITE     = 0;
-
        /**
         * Lists all cache keys
         *
@@ -46,7 +36,7 @@ interface ICache
         *
         * @return bool
         */
-       public function set($key, $value, $ttl = self::FIVE_MINUTES);
+       public function set($key, $value, $ttl = Cache::FIVE_MINUTES);
 
        /**
         * Delete a key from the cache
index 57c1698c9a1d25f62f60ac44d0ab95b5ec9d35cf..002aabdfde68cfb44e5d532da42f1d23c6d686b7 100644 (file)
@@ -3,7 +3,6 @@
 namespace Friendica\Core\Cache;
 
 use Exception;
-use Friendica\Core\Cache;
 use Friendica\Core\Config\Configuration;
 use Memcache;
 
@@ -12,7 +11,7 @@ use Memcache;
  *
  * @author Hypolite Petovan <hypolite@mrpetovan.com>
  */
-class MemcacheCache extends AbstractCache implements IMemoryCache
+class MemcacheCache extends Cache implements IMemoryCache
 {
        use TraitCompareSet;
        use TraitCompareDelete;
@@ -48,7 +47,7 @@ class MemcacheCache extends AbstractCache implements IMemoryCache
         */
        public function getAllKeys($prefix = null)
        {
-               $keys = [];
+               $keys     = [];
                $allSlabs = $this->memcache->getExtendedStats('slabs');
                foreach ($allSlabs as $slabs) {
                        foreach (array_keys($slabs) as $slabId) {
@@ -72,7 +71,7 @@ class MemcacheCache extends AbstractCache implements IMemoryCache
         */
        public function get($key)
        {
-               $return = null;
+               $return   = null;
                $cachekey = $this->getCacheKey($key);
 
                // We fetch with the hostname as key to avoid problems with other applications
index e4c4ef352ad2c72d299e8a3d92c8b282de886b1d..9b54f05b02ab0884ec588eb7f9d3d1d277ee095c 100644 (file)
@@ -3,7 +3,6 @@
 namespace Friendica\Core\Cache;
 
 use Exception;
-use Friendica\Core\Cache;
 use Friendica\Core\Config\Configuration;
 use Memcached;
 use Psr\Log\LoggerInterface;
@@ -13,7 +12,7 @@ use Psr\Log\LoggerInterface;
  *
  * @author Hypolite Petovan <hypolite@mrpetovan.com>
  */
-class MemcachedCache extends AbstractCache implements IMemoryCache
+class MemcachedCache extends Cache implements IMemoryCache
 {
        use TraitCompareSet;
        use TraitCompareDelete;
@@ -36,6 +35,7 @@ class MemcachedCache extends AbstractCache implements IMemoryCache
         * }
         *
         * @param array $memcached_hosts
+        *
         * @throws \Exception
         */
        public function __construct(string $hostname, Configuration $config, LoggerInterface $logger)
@@ -75,7 +75,7 @@ class MemcachedCache extends AbstractCache implements IMemoryCache
                if ($this->memcached->getResultCode() == Memcached::RES_SUCCESS) {
                        return $this->filterArrayKeysByPrefix($keys, $prefix);
                } else {
-                       $this->logger->debug('Memcached \'getAllKeys\' failed', ['result' =>  $this->memcached->getResultMessage()]);
+                       $this->logger->debug('Memcached \'getAllKeys\' failed', ['result' => $this->memcached->getResultMessage()]);
                        return [];
                }
        }
@@ -85,7 +85,7 @@ class MemcachedCache extends AbstractCache implements IMemoryCache
         */
        public function get($key)
        {
-               $return = null;
+               $return   = null;
                $cachekey = $this->getCacheKey($key);
 
                // We fetch with the hostname as key to avoid problems with other applications
@@ -94,7 +94,7 @@ class MemcachedCache extends AbstractCache implements IMemoryCache
                if ($this->memcached->getResultCode() === Memcached::RES_SUCCESS) {
                        $return = $value;
                } else {
-                       $this->logger->debug('Memcached \'get\' failed', ['result' =>  $this->memcached->getResultMessage()]);
+                       $this->logger->debug('Memcached \'get\' failed', ['result' => $this->memcached->getResultMessage()]);
                }
 
                return $return;
index 67f606958a35ddbdfc0375196425857dbbcc26d3..d2b0092a8856eb659c961aa32a1e723385d48f96 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Friendica\Core\Cache;
 
-use Friendica\Core\Cache;
 use Friendica\Core\System;
 use Friendica\Util\Profiler;
 
index 40cb56d35cdaa9939c7cc998f006b0059125ede4..e3884e608657b5ac1f15906c27ee7554d1c1077a 100644 (file)
@@ -3,7 +3,6 @@
 namespace Friendica\Core\Cache;
 
 use Exception;
-use Friendica\Core\Cache;
 use Friendica\Core\Config\Configuration;
 use Redis;
 
@@ -13,7 +12,7 @@ use Redis;
  * @author Hypolite Petovan <hypolite@mrpetovan.com>
  * @author Roland Haeder <roland@mxchange.org>
  */
-class RedisCache extends AbstractCache implements IMemoryCache
+class RedisCache extends Cache implements IMemoryCache
 {
        /**
         * @var Redis
index ef59f69cd17f4fd1a5d868337d4d517720480b68..a553f875160038f23c1fc73f5c13be8873373d34 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace Friendica\Core\Cache;
 
-use Friendica\Core\Cache;
-
 /**
  * Trait TraitCompareSetDelete
  *
index 77a6028355c41e4f0bb6d25ab6a023ad7b14ddbf..9c192d95290c58ac33399af54264057bb3966bf4 100644 (file)
@@ -2,8 +2,6 @@
 
 namespace Friendica\Core\Cache;
 
-use Friendica\Core\Cache;
-
 /**
  * Trait TraitCompareSetDelete
  *
diff --git a/src/Core/Lock/AbstractLock.php b/src/Core/Lock/AbstractLock.php
deleted file mode 100644 (file)
index 31744a9..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-namespace Friendica\Core\Lock;
-
-/**
- * Class AbstractLock
- *
- * @package Friendica\Core\Lock
- *
- * Basic class for Locking with common functions (local acquired locks, releaseAll, ..)
- */
-abstract class AbstractLock implements ILock
-{
-       /**
-        * @var array The local acquired locks
-        */
-       protected $acquiredLocks = [];
-
-       /**
-        * Check if we've locally acquired a lock
-        *
-        * @param string key The Name of the lock
-        *
-        * @return bool      Returns true if the lock is set
-        */
-       protected function hasAcquiredLock($key)
-       {
-               return isset($this->acquireLock[$key]) && $this->acquiredLocks[$key] === true;
-       }
-
-       /**
-        * Mark a locally acquired lock
-        *
-        * @param string $key The Name of the lock
-        */
-       protected function markAcquire($key)
-       {
-               $this->acquiredLocks[$key] = true;
-       }
-
-       /**
-        * Mark a release of a locally acquired lock
-        *
-        * @param string $key The Name of the lock
-        */
-       protected function markRelease($key)
-       {
-               unset($this->acquiredLocks[$key]);
-       }
-
-       /**
-        * Releases all lock that were set by us
-        *
-        * @return boolean Was the unlock of all locks successful?
-        */
-       public function releaseAll()
-       {
-               $return = true;
-
-               foreach ($this->acquiredLocks as $acquiredLock => $hasLock) {
-                       if (!$this->releaseLock($acquiredLock)) {
-                               $return = false;
-                       }
-               }
-
-               return $return;
-       }
-}
index b38c5ed9afe080e7332095299d9b38a1e8702b84..36a7b4edfb2216703eed9cbe50cf3c19bfea9602 100644 (file)
@@ -5,7 +5,7 @@ namespace Friendica\Core\Lock;
 use Friendica\Core\Cache;
 use Friendica\Core\Cache\IMemoryCache;
 
-class CacheLock extends AbstractLock
+class CacheLock extends Lock
 {
        /**
         * @var \Friendica\Core\Cache\ICache;
index e451f5acb048c8ff8f3777433511a834b3f0247b..e5274b9b9b53ead7832bf13c56be88aa2bf98e7b 100644 (file)
@@ -9,7 +9,7 @@ use Friendica\Util\DateTimeFormat;
 /**
  * Locking driver that stores the locks in the database
  */
-class DatabaseLock extends AbstractLock
+class DatabaseLock extends Lock
 {
        /**
         * The current ID of the process
diff --git a/src/Core/Lock/Lock.php b/src/Core/Lock/Lock.php
new file mode 100644 (file)
index 0000000..4418fee
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+
+namespace Friendica\Core\Lock;
+
+/**
+ * Class AbstractLock
+ *
+ * @package Friendica\Core\Lock
+ *
+ * Basic class for Locking with common functions (local acquired locks, releaseAll, ..)
+ */
+abstract class Lock implements ILock
+{
+       /**
+        * @var array The local acquired locks
+        */
+       protected $acquiredLocks = [];
+
+       /**
+        * Check if we've locally acquired a lock
+        *
+        * @param string key The Name of the lock
+        *
+        * @return bool      Returns true if the lock is set
+        */
+       protected function hasAcquiredLock($key)
+       {
+               return isset($this->acquireLock[$key]) && $this->acquiredLocks[$key] === true;
+       }
+
+       /**
+        * Mark a locally acquired lock
+        *
+        * @param string $key The Name of the lock
+        */
+       protected function markAcquire($key)
+       {
+               $this->acquiredLocks[$key] = true;
+       }
+
+       /**
+        * Mark a release of a locally acquired lock
+        *
+        * @param string $key The Name of the lock
+        */
+       protected function markRelease($key)
+       {
+               unset($this->acquiredLocks[$key]);
+       }
+
+       /**
+        * Releases all lock that were set by us
+        *
+        * @return boolean Was the unlock of all locks successful?
+        */
+       public function releaseAll()
+       {
+               $return = true;
+
+               foreach ($this->acquiredLocks as $acquiredLock => $hasLock) {
+                       if (!$this->releaseLock($acquiredLock)) {
+                               $return = false;
+                       }
+               }
+
+               return $return;
+       }
+}
index b791d8c39261c58662958f0a0fb642e8e592e74e..789c9e8ecac2527c853d6cb1b131dcb4d73757be 100644 (file)
@@ -4,7 +4,7 @@ namespace Friendica\Core\Lock;
 
 use Friendica\Core\Cache;
 
-class SemaphoreLock extends AbstractLock
+class SemaphoreLock extends Lock
 {
        private static $semaphore = [];
 
index afb799e01c328b0db085c4ca0edd14c0a3b69beb..7b30c553e230fb6dcfa5ec9c4cc49d1c6057c7c4 100644 (file)
@@ -22,7 +22,7 @@ class CacheFactory
        /**
         * @var string The default cache if nothing set
         */
-       const DEFAULT_TYPE = Cache\AbstractCache::TYPE_DATABASE;
+       const DEFAULT_TYPE = Cache\Cache::TYPE_DATABASE;
 
        /**
         * @var Configuration The configuration to read parameters out of the config
@@ -73,16 +73,16 @@ class CacheFactory
                }
 
                switch ($type) {
-                       case Cache\AbstractCache::TYPE_MEMCACHE:
+                       case Cache\Cache::TYPE_MEMCACHE:
                                $cache = new Cache\MemcacheCache($this->hostname, $this->config);
                                break;
-                       case Cache\AbstractCache::TYPE_MEMCACHED:
+                       case Cache\Cache::TYPE_MEMCACHED:
                                $cache = new Cache\MemcachedCache($this->hostname, $this->config, $this->logger);
                                break;
-                       case Cache\AbstractCache::TYPE_REDIS:
+                       case Cache\Cache::TYPE_REDIS:
                                $cache = new Cache\RedisCache($this->hostname, $this->config);
                                break;
-                       case Cache\AbstractCache::TYPE_APCU:
+                       case Cache\Cache::TYPE_APCU:
                                $cache = new Cache\APCuCache($this->hostname);
                                break;
                        default:
index c1e76f6dea02fc10ad0c8391ea6dacdbbfead44f..fef6708d21aad174c415311cd421cccc59bb8e0e 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Friendica\Factory;
 
-use Friendica\Core\Cache\AbstractCache;
+use Friendica\Core\Cache\Cache;
 use Friendica\Core\Cache\IMemoryCache;
 use Friendica\Core\Config\Configuration;
 use Friendica\Core\Lock;
@@ -63,10 +63,10 @@ class LockFactory
 
                try {
                        switch ($lock_type) {
-                               case AbstractCache::TYPE_MEMCACHE:
-                               case AbstractCache::TYPE_MEMCACHED:
-                               case AbstractCache::TYPE_REDIS:
-                               case AbstractCache::TYPE_APCU:
+                               case Cache::TYPE_MEMCACHE:
+                               case Cache::TYPE_MEMCACHED:
+                               case Cache::TYPE_REDIS:
+                               case Cache::TYPE_APCU:
                                        $cache = $this->cacheFactory->create($lock_type);
                                        if ($cache instanceof IMemoryCache) {
                                                return new Lock\CacheLock($cache);
@@ -115,7 +115,7 @@ class LockFactory
 
                // 2. Try to use Cache Locking (don't use the DB-Cache Locking because it works different!)
                $cache_type = $this->config->get('system', 'cache_driver', 'database');
-               if ($cache_type != AbstractCache::TYPE_DATABASE) {
+               if ($cache_type != Cache::TYPE_DATABASE) {
                        try {
                                $cache = $this->cacheFactory->create($cache_type);
                                if ($cache instanceof IMemoryCache) {