public function set(string $key, $value): void
    {
        if (isset($this->data[$key])) {
            unset($this->data[$key]);
        } else {
            if ($this->size >= $this->maxSize) {
                \reset($this->data);
                unset($this->data[\key($this->data)]);
            } else {
                $this->size++;
            }
        }
        
        $this->data[$key] = $value;
    }
public function set(string $key, $value): void
    {
        if (isset($this->data[$key])) {
            unset($this->data[$key]);
        } else {
            if ($this->size >= $this->maxSize) {
                \reset($this->data);
                unset($this->data[\key($this->data)]);
            } else {
                $this->size++;
            }
        }
        
        $this->data[$key] = $value;
    }
public function set ( string $ key , $ value ) : void { if ( isset ( $ this -> data [ $ key ] ) ) { unset ( $ this -> data [ $ key ] ) ; } else { if ( $ this -> size >= $ this -> maxSize ) { \ reset ( $ this -> data ) ; unset ( $ this -> data [ \ key ( $ this -> data ) ] ) ; } else { $ this -> size ++ ; } } $ this -> data [ $ key ] = $ value ; }
Put an item into the cache.
Put an item into the cache .