mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 02:24:26 +00:00
75 lines
1.2 KiB
PHP
75 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\Core\Profiler;
|
|
|
|
class CacheProfile
|
|
{
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private $serverStats;
|
|
|
|
/**
|
|
* @param array $serverStats
|
|
*/
|
|
public function __construct(array $serverStats)
|
|
{
|
|
$this->serverStats = array_replace([
|
|
'hits' => 0,
|
|
'misses' => 0,
|
|
'uptime' => 0,
|
|
'memory_usage' => 0,
|
|
'memory_available' => 0
|
|
], $serverStats);
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getHits()
|
|
{
|
|
return (int) $this->serverStats['hits'];
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getMisses()
|
|
{
|
|
return (int) $this->serverStats['misses'];
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getUptime()
|
|
{
|
|
return (int) $this->serverStats['uptime'];
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getMemUsage()
|
|
{
|
|
return (int) $this->serverStats['memory_usage'];
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getMemAvailable()
|
|
{
|
|
return (int) $this->serverStats['memory_available'];
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getServerStats()
|
|
{
|
|
return $this->serverStats;
|
|
}
|
|
}
|