36 throw new \InvalidArgumentException();
38 $this->maximumSize =
$size;
49 if (isset($this->data[
$key])) {
51 return $this->data[
$key];
65 if (isset($this->data[
$key])) {
70 if ($this->
size() > $this->maximumSize) {
73 unset($this->data[key($this->data)]);
84 return count($this->data);
94 return isset($this->data[
$key]);
104 if (isset($this->data[
$key])) {
106 unset($this->data[$key]);
119 $this->data = array();
130 unset($this->data[
$key]);
156 return $this->
get(
$key);
size()
Get the number of elements in the cache.
recordAccess($key)
Moves the element from current position to end of array.
offsetGet($key)
Get the value for specified key.
offsetExists($key)
Does key exist?
__construct($size)
Create a LRU Cache.
containsKey($key)
Does the cache contain an element with this key.
offsetSet($key, $value)
Assigns a value for the specified key.
offsetUnset($key)
Unsets a key.