mirror of
https://github.com/friendica/friendica
synced 2025-04-25 20:30:11 +00:00
Rename *CacheDriver to *Cache because they don't act as driver anymore
This commit is contained in:
parent
d56bd28a07
commit
86bf2ee45a
38 changed files with 152 additions and 144 deletions
|
@ -6,11 +6,11 @@ use Exception;
|
|||
use Friendica\Core\Cache;
|
||||
|
||||
/**
|
||||
* APCu Cache Driver.
|
||||
* APCu Cache.
|
||||
*
|
||||
* @author Philipp Holzer <admin@philipp.info>
|
||||
*/
|
||||
class APCuCache extends AbstractCacheDriver implements IMemoryCacheDriver
|
||||
class APCuCache extends AbstractCache implements IMemoryCache
|
||||
{
|
||||
use TraitCompareSet;
|
||||
use TraitCompareDelete;
|
||||
|
|
|
@ -5,11 +5,11 @@ namespace Friendica\Core\Cache;
|
|||
/**
|
||||
* Abstract class for common used functions
|
||||
*
|
||||
* Class AbstractCacheDriver
|
||||
* Class AbstractCache
|
||||
*
|
||||
* @package Friendica\Core\Cache
|
||||
*/
|
||||
abstract class AbstractCacheDriver implements ICacheDriver
|
||||
abstract class AbstractCache implements ICache
|
||||
{
|
||||
/**
|
||||
* @var string The hostname
|
|
@ -5,13 +5,13 @@ namespace Friendica\Core\Cache;
|
|||
use Friendica\Core\Cache;
|
||||
|
||||
/**
|
||||
* Implementation of the IMemoryCacheDriver mainly for testing purpose
|
||||
* Implementation of the IMemoryCache mainly for testing purpose
|
||||
*
|
||||
* Class ArrayCache
|
||||
*
|
||||
* @package Friendica\Core\Cache
|
||||
*/
|
||||
class ArrayCache extends AbstractCacheDriver implements IMemoryCacheDriver
|
||||
class ArrayCache extends AbstractCache implements IMemoryCache
|
||||
{
|
||||
use TraitCompareDelete;
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ use Friendica\Database\Database;
|
|||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
/**
|
||||
* Database Cache Driver
|
||||
* Database Cache
|
||||
*
|
||||
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
||||
*/
|
||||
class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
|
||||
class DatabaseCache extends AbstractCache implements ICache
|
||||
{
|
||||
/**
|
||||
* @var Database
|
|
@ -3,11 +3,11 @@
|
|||
namespace Friendica\Core\Cache;
|
||||
|
||||
/**
|
||||
* Cache Driver Interface
|
||||
* Cache Interface
|
||||
*
|
||||
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
||||
*/
|
||||
interface ICacheDriver
|
||||
interface ICache
|
||||
{
|
||||
const MONTH = 2592000;
|
||||
const WEEK = 604800;
|
|
@ -5,11 +5,11 @@ namespace Friendica\Core\Cache;
|
|||
/**
|
||||
* This interface defines methods for Memory-Caches only
|
||||
*
|
||||
* Interface IMemoryCacheDriver
|
||||
* Interface IMemoryCache
|
||||
*
|
||||
* @package Friendica\Core\Cache
|
||||
*/
|
||||
interface IMemoryCacheDriver extends ICacheDriver
|
||||
interface IMemoryCache extends ICache
|
||||
{
|
||||
/**
|
||||
* Sets a value if it's not already stored
|
||||
|
@ -19,7 +19,7 @@ interface IMemoryCacheDriver extends ICacheDriver
|
|||
* @param int $ttl The cache lifespan, must be one of the Cache constants
|
||||
* @return bool
|
||||
*/
|
||||
public function add($key, $value, $ttl = ICacheDriver::FIVE_MINUTES);
|
||||
public function add($key, $value, $ttl = ICache::FIVE_MINUTES);
|
||||
|
||||
/**
|
||||
* Compares if the old value is set and sets the new value
|
||||
|
@ -31,7 +31,7 @@ interface IMemoryCacheDriver extends ICacheDriver
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function compareSet($key, $oldValue, $newValue, $ttl = ICacheDriver::FIVE_MINUTES);
|
||||
public function compareSet($key, $oldValue, $newValue, $ttl = ICache::FIVE_MINUTES);
|
||||
|
||||
/**
|
||||
* Compares if the old value is set and removes it
|
|
@ -8,11 +8,11 @@ use Friendica\Core\Config\Configuration;
|
|||
use Memcache;
|
||||
|
||||
/**
|
||||
* Memcache Cache Driver
|
||||
* Memcache Cache
|
||||
*
|
||||
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
||||
*/
|
||||
class MemcacheCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
|
||||
class MemcacheCache extends AbstractCache implements IMemoryCache
|
||||
{
|
||||
use TraitCompareSet;
|
||||
use TraitCompareDelete;
|
|
@ -9,11 +9,11 @@ use Memcached;
|
|||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Memcached Cache Driver
|
||||
* Memcached Cache
|
||||
*
|
||||
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
||||
*/
|
||||
class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
|
||||
class MemcachedCache extends AbstractCache implements IMemoryCache
|
||||
{
|
||||
use TraitCompareSet;
|
||||
use TraitCompareDelete;
|
|
@ -11,10 +11,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 +23,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 +104,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 +122,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 +140,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);
|
||||
|
|
|
@ -8,12 +8,12 @@ use Friendica\Core\Config\Configuration;
|
|||
use Redis;
|
||||
|
||||
/**
|
||||
* Redis Cache Driver. This driver is based on Memcache driver
|
||||
* Redis Cache. This driver is based on Memcache driver
|
||||
*
|
||||
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
||||
* @author Roland Haeder <roland@mxchange.org>
|
||||
*/
|
||||
class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
|
||||
class RedisCache extends AbstractCache implements IMemoryCache
|
||||
{
|
||||
/**
|
||||
* @var Redis
|
Loading…
Add table
Add a link
Reference in a new issue