1 | <?php |
||
17 | abstract class ExpiringKeyValue extends Storage { |
||
18 | |||
19 | /** |
||
20 | * Save data by auto-expire key |
||
21 | * @param $key |
||
22 | * @param string $data |
||
23 | * @param int $expire |
||
24 | */ |
||
25 | abstract protected function set($key, $data, $expire); |
||
26 | |||
27 | /** |
||
28 | * Get data by key if not expired |
||
29 | * @param $key |
||
30 | * @return string |
||
31 | */ |
||
32 | abstract protected function get($key); |
||
33 | |||
34 | /** |
||
35 | * Remove key in store |
||
36 | * @param $key |
||
37 | * @return mixed |
||
38 | */ |
||
39 | abstract protected function delete($key); |
||
40 | |||
41 | /** |
||
42 | * Get postponed data from storage and delete |
||
43 | * @param string $key |
||
44 | * @return string |
||
45 | */ |
||
46 | public function pop($key) { |
||
53 | |||
54 | /** |
||
55 | * Save postponed data to storage |
||
56 | * @param string $key |
||
57 | * @param string $data |
||
58 | */ |
||
59 | public function push($key, $data) { |
||
62 | } |
||
63 |