-
Notifications
You must be signed in to change notification settings - Fork 2
/
Memcache.php
92 lines (82 loc) · 2.08 KB
/
Memcache.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* class implements MemcacheInterface if Memcache available in system
*
* @author val@filin.us
*/
namespace PhishCheck;
/**
* Class Memcache
* @package PhishCheck
* @class Memcache
* @deprecated
*/
class Memcache extends \Memcache implements namespace\MemcacheInterface {
function __construct(array $options=array()) {
parent::__costruct();
}
private $isPersitent = false;
/**
* @return boolean
*/
public function isPersistent() {
return $this->isPersitent;
}
/**
* raises exception if there were some non-data manipulation result code
*
* @return bool
* @throws MemcacheFatalError
*/
public function isSafeMemcacheError() {
$mcResultCode = $this->getResultCode();
if (in_array($mcResultCode, array(
\Memcache::RES_SUCCESS,
\Memcache::RES_STORED,
\Memcache::RES_DELETED,
\Memcache::RES_DATA_EXISTS,
\Memcache::RES_NOTFOUND,
\Memcache::RES_NOTSTORED,
\Memcache::RES_END,
\Memcache::RES_BUFFERED
))) {
return true;
}
throw new namespace\MemcacheFatalError('Memcache Fatal Error ', $mcResultCode);
}
/**
* @param string $key
* @return mixed
*/
public function get($key) {
$flag = false;
return parent::get($key, $flag);
}
/**
* @param string $key
* @param mixed $value
* @param int $timeout
* @return mixed
*/
public function set($key, $value, $timeout) {
return parent::set($key, $value, null, $timeout);
}
/**
* @param string $key
* @param mixed $value
* @param int $timeout
* @return boolean
*/
public function add($key, $value, $timeout) {
return parent::add($key, $value, null, $timeout);
}
/**
* @param string $key
* @param mixed $value
* @param int $timeout
* @return boolean
*/
public function replace($key, $value, $timeout) {
return parent::replace($key, $value, null, $timeout);
}
}