summaryrefslogtreecommitdiff
path: root/classes/cache/RedisCache.php
diff options
context:
space:
mode:
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