| 1 | <?php |
||
| 14 | class DummyStorage implements StorageInterface |
||
| 15 | { |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Gets data for $key from storage |
||
| 19 | * |
||
| 20 | * @param $key |
||
| 21 | * |
||
| 22 | * @return mixed |
||
| 23 | */ |
||
| 24 | public function get($key) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Stores data for $key into storage |
||
| 31 | * |
||
| 32 | * @param $key |
||
| 33 | * @param $value |
||
| 34 | * @param int $duration |
||
| 35 | */ |
||
| 36 | public function set($key, $value, $duration = 0): void |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Method combines both [[set()]] and [[get()]] methods to retrieve value identified by a $key, |
||
| 43 | * or to store the result of $callable execution if there is no cache available for the $ip. |
||
| 44 | * |
||
| 45 | * @param $key |
||
| 46 | * @param $callable |
||
| 47 | * @param int $duration |
||
| 48 | * |
||
| 49 | * @return mixed |
||
| 50 | */ |
||
| 51 | public function getOrSet($key, $callable, $duration = 0) |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Deletes record from storage for $key |
||
| 59 | * |
||
| 60 | * @param $key |
||
| 61 | * |
||
| 62 | * @return mixed |
||
| 63 | */ |
||
| 64 | public function delete($key): void |
||
| 68 | |||
| 69 | /** |
||
| 70 | * Builds a normalized storage key from a given IP. |
||
| 71 | * |
||
| 72 | * @param mixed $key the key to be normalized |
||
| 73 | * |
||
| 74 | * @return string the generated cache key |
||
| 75 | */ |
||
| 76 | public function buildKey($key): string |
||
| 80 | } |