blob: 1c96f5a1848097030482820c4604f8ed0ecb7db1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
/** Cache interface
* -----------------------------------------------------------------------------
*
* Interface to save results of expensive data-extraction proccess,
* in a fast-accessed medium (ussually RAM or NVME SSD units)
*
* -----------------------------------------------------------------------------
*/
interface Cache_interface
{
/** Cache::set($key, $data, $ttl) : void
*
* @param $key (string): reference label
* @param $data (mixed): actual data (avoid storing true|false)
* @param $ttl (int): time to live (seconds)
*/
public function set(string $key, $data, int $ttl);
/** Cache::get($key) : mixed
*
* @param $key (string)
* @return mixed: fetched $data -or- false on failure
*/
public function get(string $key);
/** Cache::flush( $olderThan ) : void
*
* clear cache older than $olderThan
* @param $olderThan (int) in seconds
*/
public function flush(int $olderThan = 0);
}
|