1 | <?php |
||
38 | class Memcached |
||
39 | { |
||
40 | /** |
||
41 | * Holds the memcached object |
||
42 | * |
||
43 | * @var object |
||
44 | */ |
||
45 | protected $memcached; |
||
46 | |||
47 | /** |
||
48 | * Memcached configuration |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $memcacheConf = [ |
||
53 | 'default' => [ |
||
54 | 'host' => '127.0.0.1', |
||
55 | 'port' => 11211, |
||
56 | 'weight' => 1, |
||
57 | ], |
||
58 | ]; |
||
59 | |||
60 | /** |
||
61 | * Class constructor |
||
62 | * |
||
63 | * Setup Memcache(d) |
||
64 | * |
||
65 | * @param array $config |
||
66 | * @return void |
||
|
|||
67 | * |
||
68 | * @throws \Kotori\Exception\CacheException |
||
69 | */ |
||
70 | 1 | public function __construct($config = []) |
|
128 | |||
129 | /** |
||
130 | * Fetch from cache |
||
131 | * |
||
132 | * @param string $key |
||
133 | * @return mixed |
||
134 | */ |
||
135 | 6 | public function get($key) |
|
141 | |||
142 | /** |
||
143 | * Set |
||
144 | * |
||
145 | * @param string $key |
||
146 | * @param mixed $value |
||
147 | * @param int $ttl |
||
148 | * @param boolean $raw |
||
149 | * @return boolean |
||
150 | */ |
||
151 | 6 | public function set($key, $value, $ttl = 60, $raw = false) |
|
165 | |||
166 | /** |
||
167 | * Delete from Cache |
||
168 | * |
||
169 | * @param mixed $key |
||
170 | * @return boolean |
||
171 | */ |
||
172 | 3 | public function delete($key) |
|
176 | |||
177 | /** |
||
178 | * Clean the Cache |
||
179 | * |
||
180 | * @return boolean |
||
181 | */ |
||
182 | 1 | public function clear() |
|
186 | |||
187 | /** |
||
188 | * Is supported |
||
189 | * |
||
190 | * Returns FALSE if memcached is not supported on the system. |
||
191 | * If it is, we setup the memcached object & return TRUE |
||
192 | * |
||
193 | * @return boolean |
||
194 | */ |
||
195 | 1 | public function isSupported() |
|
199 | } |
||
200 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.