| @@ 59-65 (lines=7) @@ | ||
| 56 | * |
|
| 57 | * @return bool true on success or false on failure. |
|
| 58 | */ |
|
| 59 | public function set(string $key, $value, int $ttl = null) : bool |
|
| 60 | { |
|
| 61 | $ttl = $ttl ?? $this->ttl; |
|
| 62 | $key = $this->namespacedKey($key); |
|
| 63 | ||
| 64 | return $this->memcachedInstance->set($key, $value, $ttl); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Return the valid cache value stored with the given key. |
|
| @@ 74-81 (lines=8) @@ | ||
| 71 | * |
|
| 72 | * @return mixed the data found. |
|
| 73 | */ |
|
| 74 | public function get(string $key) |
|
| 75 | { |
|
| 76 | $key = $this->namespacedKey($key); |
|
| 77 | $value = $this->memcachedInstance->get($key); |
|
| 78 | if ($this->exists($key)) { |
|
| 79 | return $value; |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Delete cache especified by key. |
|