blob: d6ae2f4f662bed82d0027932d0572daf3488cf2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
}
}
|