summaryrefslogtreecommitdiff
path: root/classes/cache/RedisCache.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:16:23 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 07:16:23 +0200
commit7076343338ae3439f3c86f01144818abe8c31978 (patch)
tree794abb1e6b8f821091fd095341885496b6dad51d /classes/cache/RedisCache.php
parent47cbb529f5723b246125ae083a193e11481b89ef (diff)
downloadclassroom-7076343338ae3439f3c86f01144818abe8c31978.tar.gz
classroom-7076343338ae3439f3c86f01144818abe8c31978.tar.bz2
classroom-7076343338ae3439f3c86f01144818abe8c31978.zip
add container helpers; constuct public directory-tree
Diffstat (limited to 'classes/cache/RedisCache.php')
-rw-r--r--classes/cache/RedisCache.php69
1 files changed, 0 insertions, 69 deletions
diff --git a/classes/cache/RedisCache.php b/classes/cache/RedisCache.php
deleted file mode 100644
index ec50f08..0000000
--- a/classes/cache/RedisCache.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-/** Redis Cache implementation
- * ---
- * This class uses \Predis\Redis, so do not forget require it via composer
- * or to use the configuration options you will find into \README.md
- */
-class RedisCache implements Cache_interface
-{
- /** set
- * store $data under the label $key
- * cache expires in $ttl seconds
- */
- public function set($key, $data, $ttl)
- {
- $serialized = serialize($data);
-
- if ($serialized = '') {
- return false;
- }
-
- try {
- $redis = new \Predis\Client([
- 'host' => \REDIS_HOST
- ]);
- return $redis->set($key, $serialized, 'EX', $ttl);
-
- } catch (Exception $e) {
- // ...
- }
- }
-
-
- /** get
- * fetch previously stored $data under label $key
- * return $data (or false)
- */
- public function get($key)
- {
-
- try {
-
- $redis = new \Predis\Client([
- 'host' => \REDIS_HOST
- ]);
-
- if ($redis->exists($key)) {
- return unserialize($redis->get($key));
-
- } else {
- return false;
- }
-
- } catch (Exception $e) {
- // ...
- }
-
- }
-
-
- /** flush
- * --- not umplemented yet; may not needed
- */
- public function flush($olderThan = 0)
- {
- return false; // until implementation
- }
-
-} \ No newline at end of file