mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-04 10:19:25 +02:00
29 lines
477 B
PHP
29 lines
477 B
PHP
<?php
|
|
|
|
namespace React\Cache;
|
|
|
|
use React\Promise;
|
|
|
|
class ArrayCache implements CacheInterface
|
|
{
|
|
private $data = array();
|
|
|
|
public function get($key)
|
|
{
|
|
if (!isset($this->data[$key])) {
|
|
return Promise\reject();
|
|
}
|
|
|
|
return Promise\resolve($this->data[$key]);
|
|
}
|
|
|
|
public function set($key, $value)
|
|
{
|
|
$this->data[$key] = $value;
|
|
}
|
|
|
|
public function remove($key)
|
|
{
|
|
unset($this->data[$key]);
|
|
}
|
|
}
|