1 | <?php |
||
21 | class MemcachedCache extends AbstractCache |
||
22 | { |
||
23 | private $mc; |
||
24 | |||
25 | function __construct() |
||
26 | { |
||
27 | global $memcacheServer, $memcachePort; |
||
28 | |||
29 | $this->mc = new Memcached("zKB"); |
||
30 | if(substr($memcacheServer, 0, 7) == "unix://") |
||
31 | $this->mc->addServer(substr($memcacheServer, 7), 0); |
||
32 | else |
||
33 | $this->mc->addServer($memcacheServer, $memcachePort); |
||
34 | } |
||
35 | |||
36 | public function get($key) |
||
40 | |||
41 | /** |
||
42 | * @param string $timeout |
||
43 | */ |
||
44 | public function set($key, $value, $timeout) |
||
48 | |||
49 | /** |
||
50 | * @param string $timeout |
||
51 | */ |
||
52 | public function replace($key, $value, $timeout) |
||
56 | |||
57 | /** |
||
58 | * @param string $key |
||
59 | */ |
||
60 | public function delete($key) |
||
64 | |||
65 | public function increment($key, $step = 1, $timeout = 0) |
||
69 | |||
70 | public function decrement($key, $step = 1, $timeout = 0) |
||
74 | |||
75 | public function flush() |
||
79 | } |
||
80 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.