<?php
namespace PhpOffice\PhpSpreadsheet\Collection;
> use DateInterval;
use Psr\SimpleCache\CacheInterface;
/**
* This is the default implementation for in-memory cell collection.
*
* Alternatives implementation should leverage off-memory, non-volatile storage
* to reduce overall memory usage.
*/
class Memory implements CacheInterface
{
private $cache = [];
> /**
public function clear()
> * @return bool
{
> */
$this->cache = [];
return true;
}
> /**
public function delete($key)
> * @param string $key
{
> *
unset($this->cache[$key]);
> * @return bool
> */
return true;
}
> /**
public function deleteMultiple($keys)
> * @param iterable $keys
{
> *
foreach ($keys as $key) {
> * @return bool
$this->delete($key);
> */
}
return true;
}
> /**
public function get($key, $default = null)
> * @param string $key
{
> * @param mixed $default
if ($this->has($key)) {
> *
return $this->cache[$key];
> * @return mixed
}
> */
return $default;
}
> /**
public function getMultiple($keys, $default = null)
> * @param iterable $keys
{
> * @param mixed $default
$results = [];
> *
foreach ($keys as $key) {
> * @return iterable
$results[$key] = $this->get($key, $default);
> */
}
return $results;
}
> /**
public function has($key)
> * @param string $key
{
> *
return array_key_exists($key, $this->cache);
> * @return bool
}
> */
> /**
public function set($key, $value, $ttl = null)
> * @param string $key
{
> * @param mixed $value
$this->cache[$key] = $value;
> * @param null|DateInterval|int $ttl
> *
return true;
> * @return bool
}
> */
> /**
public function setMultiple($values, $ttl = null)
> * @param iterable $values
{
> * @param null|DateInterval|int $ttl
foreach ($values as $key => $value) {
> *
$this->set($key, $value);
> * @return bool
}
> */
return true;
}
}