1<?php
2namespace Cache;
3class 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}
28