summaryrefslogtreecommitdiff
path: root/classes/cache/Cache_interface.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:01:30 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:01:30 +0200
commit47cbb529f5723b246125ae083a193e11481b89ef (patch)
tree31ab20b2fbf12bee1cd994c3d6fb822fa52622e3 /classes/cache/Cache_interface.php
downloadclassroom-47cbb529f5723b246125ae083a193e11481b89ef.tar.gz
classroom-47cbb529f5723b246125ae083a193e11481b89ef.tar.bz2
classroom-47cbb529f5723b246125ae083a193e11481b89ef.zip
initializing classroom structure using anom framework
Diffstat (limited to 'classes/cache/Cache_interface.php')
-rw-r--r--classes/cache/Cache_interface.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/classes/cache/Cache_interface.php b/classes/cache/Cache_interface.php
new file mode 100644
index 0000000..7c49789
--- /dev/null
+++ b/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