diff options
Diffstat (limited to 'core/classes/cache/Cache_interface.php')
| -rw-r--r-- | core/classes/cache/Cache_interface.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/classes/cache/Cache_interface.php b/core/classes/cache/Cache_interface.php new file mode 100644 index 0000000..7c49789 --- /dev/null +++ b/core/classes/cache/Cache_interface.php @@ -0,0 +1,34 @@ +<?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); + +}
\ No newline at end of file |
