*/
class APCuCache extends AbstractCache implements ICanCacheInMemory
{
- const NAME = 'apcu';
-
use CompareSetTrait;
use CompareDeleteTrait;
+ const NAME = 'apcu';
/**
* @throws InvalidCacheDriverException
return [
'entries' => $apcu['num_entries'] ?? null,
- 'used_memory' => $apcu['mem_size'] ?? null,
- 'hits' => $apcu['num_hits'] ?? null,
- 'misses' => $apcu['num_misses'] ?? null,
- 'avail_mem' => $sma['avail_mem'] ?? null,
+ 'used_memory' => $apcu['mem_size'] ?? null,
+ 'hits' => $apcu['num_hits'] ?? null,
+ 'misses' => $apcu['num_misses'] ?? null,
+ 'avail_mem' => $sma['avail_mem'] ?? null,
];
}
}
*/
class ArrayCache extends AbstractCache implements ICanCacheInMemory
{
- const NAME = 'array';
-
use CompareDeleteTrait;
+ const NAME = 'array';
/** @var array Array with the cached data */
protected $cachedData = [];
*/
class MemcacheCache extends AbstractCache implements ICanCacheInMemory
{
- const NAME = 'memcache';
-
use CompareSetTrait;
use CompareDeleteTrait;
use MemcacheCommandTrait;
+ const NAME = 'memcache';
/**
* @var Memcache
$stats = $this->memcache->getStats();
return [
- 'version' => $stats['version'] ?? null,
- 'entries' => $stats['curr_items'] ?? null,
- 'used_memory' => $stats['bytes'] ?? null,
- 'uptime' => $stats['uptime'] ?? null,
+ 'version' => $stats['version'] ?? null,
+ 'entries' => $stats['curr_items'] ?? null,
+ 'used_memory' => $stats['bytes'] ?? null,
+ 'uptime' => $stats['uptime'] ?? null,
'connected_clients' => $stats['curr_connections'] ?? null,
- 'hits' => $stats['get_hits'] ?? null,
- 'misses' => $stats['get_misses'] ?? null,
- 'evictions' => $stats['evictions'] ?? null,
+ 'hits' => $stats['get_hits'] ?? null,
+ 'misses' => $stats['get_misses'] ?? null,
+ 'evictions' => $stats['evictions'] ?? null,
];
}
}
*/
class MemcachedCache extends AbstractCache implements ICanCacheInMemory
{
- const NAME = 'memcached';
-
use CompareSetTrait;
use CompareDeleteTrait;
use MemcacheCommandTrait;
+ const NAME = 'memcached';
/**
* @var \Memcached
}
return [
- 'version' => $stats['version'] ?? null,
- 'entries' => $stats['curr_items'] ?? null,
- 'used_memory' => $stats['bytes'] ?? null,
- 'uptime' => $stats['uptime'] ?? null,
+ 'version' => $stats['version'] ?? null,
+ 'entries' => $stats['curr_items'] ?? null,
+ 'used_memory' => $stats['bytes'] ?? null,
+ 'uptime' => $stats['uptime'] ?? null,
'connected_clients' => $stats['curr_connections'] ?? null,
- 'hits' => $stats['get_hits'] ?? null,
- 'misses' => $stats['get_misses'] ?? null,
- 'evictions' => $stats['evictions'] ?? null,
+ 'hits' => $stats['get_hits'] ?? null,
+ 'misses' => $stats['get_misses'] ?? null,
+ 'evictions' => $stats['evictions'] ?? null,
];
}
}
namespace Friendica\Core\Lock\Type;
-use Friendica\Core\Cache\Capability\ICanCache;
use Friendica\Core\Cache\Capability\ICanCacheInMemory;
use Friendica\Core\Cache\Enum\Duration;
use Friendica\Core\Cache\Exception\CachePersistenceException;
if (function_exists('opcache_get_status')) {
$status = opcache_get_status(false);
$data['opcache'] = [
- 'enabled' => $status['opcache_enabled'] ?? false,
- 'hit_rate' => $status['opcache_statistics']['opcache_hit_rate'] ?? null,
- 'used_memory' => $status['memory_usage']['used_memory'] ?? null,
- 'free_memory' => $status['memory_usage']['free_memory'] ?? null,
+ 'enabled' => $status['opcache_enabled'] ?? false,
+ 'hit_rate' => $status['opcache_statistics']['opcache_hit_rate'] ?? null,
+ 'used_memory' => $status['memory_usage']['used_memory'] ?? null,
+ 'free_memory' => $status['memory_usage']['free_memory'] ?? null,
'num_cached_scripts' => $status['opcache_statistics']['num_cached_scripts'] ?? null,
];
} else {
if ($this->cache instanceof ICanCacheInMemory) {
$data['cache'] = [
- 'type' => $this->cache->getName(),
+ 'type' => $this->cache->getName(),
'stats' => $this->cache->getStats(),
];
} else {
if ($this->lock instanceof CacheLock) {
$data['lock'] = [
- 'type' => $this->lock->getName(),
+ 'type' => $this->lock->getName(),
'stats' => $this->lock->getCacheStats(),
];
} else {