shop.balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

mem.php (607B)


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