memcached.php (599B)
1 <?php 2 namespace Cache; 3 class Memcached { 4 private $expire; 5 private $memcached; 6 7 const CACHEDUMP_LIMIT = 9999; 8 9 public function __construct($expire) { 10 $this->expire = $expire; 11 $this->memcached = new \Memcached(); 12 13 $this->memcached->addServer(CACHE_HOSTNAME, CACHE_PORT); 14 } 15 16 public function get($key) { 17 return $this->memcached->get(CACHE_PREFIX . $key); 18 } 19 20 public function set($key, $value) { 21 return $this->memcached->set(CACHE_PREFIX . $key, $value, $this->expire); 22 } 23 24 public function delete($key) { 25 $this->memcached->delete(CACHE_PREFIX . $key); 26 } 27 }