1 | <?php |
||
9 | class XcacheCache implements CacheInterface |
||
10 | { |
||
11 | |||
12 | protected $cache; |
||
13 | |||
14 | /** |
||
15 | * constructor |
||
16 | */ |
||
17 | public function __construct() |
||
23 | |||
24 | /** |
||
25 | * Connect to a server |
||
26 | * @param string $host This should be the host name or IP address you want to connect to |
||
27 | * @param int $port The port number where Memcache can be accessed |
||
28 | * @return $this |
||
29 | */ |
||
30 | public function connect($host, $port) |
||
34 | |||
35 | |||
36 | /** |
||
37 | * Adds a value to be stored on the server |
||
38 | * @param string $key This should be the key for the value you wish to add |
||
39 | * @param mixed $value The value you wish to be stored with the given key |
||
40 | * @param int $time How long should the value be stored for in seconds (0 = never expire) (max set value = 2592000 (30 Days)) |
||
41 | * @return boolean Returns true if successfully added or false on failure |
||
42 | */ |
||
43 | public function save($key, $value, $time = 0) |
||
47 | |||
48 | |||
49 | /** |
||
50 | * Replaces a stored value for a given key |
||
51 | * @param string $key This should be the key for the value you wish to replace |
||
52 | * @param mixed $value The new value that you wish to give to that key |
||
53 | * @param int $time How long should the value be stored for in seconds (0 = never expire) (max set value = 2592000 (30 Days)) |
||
54 | * @return boolean Returns true if successfully replaced or false on failure |
||
55 | */ |
||
56 | public function replace($key, $value, $time = 0) |
||
60 | |||
61 | /** |
||
62 | * Returns the values store for the given key |
||
63 | * @param string $key This should be the unique query key to get the value |
||
64 | * @return mixed The store value will be returned |
||
65 | */ |
||
66 | public function fetch($key) |
||
70 | |||
71 | /** |
||
72 | * Deletes a single value from the server based on the given key |
||
73 | * @param string $key This should be the key that you wish to delete the value for |
||
74 | * @return boolean Returns true on success or false on failure |
||
75 | */ |
||
76 | public function delete($key) |
||
80 | |||
81 | /** |
||
82 | * Deletes all values from the server |
||
83 | * @return boolean Returns true on success or false on failure |
||
84 | */ |
||
85 | public function deleteAll() |
||
89 | } |
||
90 |