35 throw new InvalidArgumentException();
37 $this->maximumSize =
$size;
48 if (isset($this->data[
$key])) {
50 return $this->data[
$key];
64 if (isset($this->data[
$key])) {
69 if ($this->
size() > $this->maximumSize) {
72 unset($this->data[key($this->data)]);
83 return count($this->data);
93 return isset($this->data[
$key]);
103 if (isset($this->data[
$key])) {
105 unset($this->data[$key]);
118 $this->data = array();
129 unset($this->data[
$key]);
155 return $this->
get(
$key);
offsetGet($key)
Get the value for specified key.
__construct($size)
Create a LRU Cache.
offsetSet($key, $value)
Assigns a value for the specified key.
size()
Get the number of elements in the cache.
containsKey($key)
Does the cache contain an element with this key.
offsetUnset($key)
Unsets a key.
offsetExists($key)
Does key exist?
recordAccess($key)
Moves the element from current position to end of array.