-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmemcache_wrapper.php
More file actions
53 lines (43 loc) · 1.23 KB
/
memcache_wrapper.php
File metadata and controls
53 lines (43 loc) · 1.23 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
class MemcacheWrapper {
private $memcache;
private $prefix;
//use temp for mile limits, gambing limits
public function __construct($prefix='') {
$this->prefix = $prefix;
$this->memcache = new Memcache();
}
public function addServer($one, $two) {
$this->memcache->addServer($one, $two);
}
public function set($one, $two, $three = null, $four = null) {
//echo "1: $one 2: $two 3: $three 4: $four ";
if($four != null) {
//echo " setting one: $one two: $two three: $three four: $four ";
$this->memcache->set($one . $this->prefix, $two, $three, $four);
}
else {
//echo " setting one: $one two: $two ";
$this->memcache->set($one . $this->prefix, $two);
}
}
public function delete($one, $two) {
$this->memcache->delete($one . $this->prefix, $two);
}
public function flush() {
$this->memcache->flush();
}
public function get($one) {
$prefix = $this->prefix;
//echo "$one $prefix";
return $this->memcache->get($one . $prefix);
}
public function add($one, $two, $three = null, $four = null) {
if($four != null) {
$this->memcache->add($one . $this->prefix, $two, $three, $four);
}
else {
$this->memcache->add($one . $this->prefix, $two);
} }
}
?>