Lines Matching refs:key
51 public function set(string $key, $data, int $ttl = self::TTL): void argument
53 if (!$this->validateKey($key)) {
54 throw new Exception('Key name '.$key.' is invalid.');
58 $this->pool[$key] = $data;
62 file_put_contents($this->dir.'/'.$key.'.php', $string);
68 public function has(string $key): bool argument
70 if (isset($this->pool[$key])) {
74 $file = $this->dir.'/'.$key.'.php';
92 public function get(string $key): ?array argument
94 if (isset($this->pool[$key])) {
95 return $this->pool[$key];
98 $file = $this->dir.'/'.$key.'.php';
102 $this->pool[$key] = unserialize($data[1]);
104 return $this->pool[$key];
135 public function delete(string $key): bool argument
139 unset($this->pool[$key]);
141 $file = $this->dir.'/'.$key.'.php';
153 private function validateKey(string $key): bool argument
155 return (bool) preg_match('/[a-z\_\-0-9]/i', $key);