diff options
Diffstat (limited to 'public/system/library/cache/memcached.php')
-rw-r--r-- | public/system/library/cache/memcached.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/public/system/library/cache/memcached.php b/public/system/library/cache/memcached.php new file mode 100644 index 0000000..d6ae2f4 --- /dev/null +++ b/public/system/library/cache/memcached.php @@ -0,0 +1,27 @@ +<?php +namespace Cache; +class Memcached { + private $expire; + private $memcached; + + const CACHEDUMP_LIMIT = 9999; + + public function __construct($expire) { + $this->expire = $expire; + $this->memcached = new \Memcached(); + + $this->memcached->addServer(CACHE_HOSTNAME, CACHE_PORT); + } + + public function get($key) { + return $this->memcached->get(CACHE_PREFIX . $key); + } + + public function set($key, $value) { + return $this->memcached->set(CACHE_PREFIX . $key, $value, $this->expire); + } + + public function delete($key) { + $this->memcached->delete(CACHE_PREFIX . $key); + } +} |