mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-09-01 19:40:30 +00:00
- slim/slim: ^3.1 - symfony/expression-language: ^3.4 - fxp/composer-asset-plugin: ~1.3 - bower-asset/vue: ^2.5 - bower-asset/vue-resource: ^1.5
52 lines
977 B
PHP
52 lines
977 B
PHP
<?php
|
|
|
|
namespace Symfony\Component\Cache\Tests\Fixtures;
|
|
|
|
use Doctrine\Common\Cache\CacheProvider;
|
|
|
|
class ArrayCache extends CacheProvider
|
|
{
|
|
private $data = array();
|
|
|
|
protected function doFetch($id)
|
|
{
|
|
return $this->doContains($id) ? $this->data[$id][0] : false;
|
|
}
|
|
|
|
protected function doContains($id)
|
|
{
|
|
if (!isset($this->data[$id])) {
|
|
return false;
|
|
}
|
|
|
|
$expiry = $this->data[$id][1];
|
|
|
|
return !$expiry || time() <= $expiry || !$this->doDelete($id);
|
|
}
|
|
|
|
protected function doSave($id, $data, $lifeTime = 0)
|
|
{
|
|
$this->data[$id] = array($data, $lifeTime ? time() + $lifeTime : false);
|
|
|
|
return true;
|
|
}
|
|
|
|
protected function doDelete($id)
|
|
{
|
|
unset($this->data[$id]);
|
|
|
|
return true;
|
|
}
|
|
|
|
protected function doFlush()
|
|
{
|
|
$this->data = array();
|
|
|
|
return true;
|
|
}
|
|
|
|
protected function doGetStats()
|
|
{
|
|
return null;
|
|
}
|
|
}
|