File tree Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Expand file tree Collapse file tree 3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -169,10 +169,24 @@ public function groups() {
169
169
/**
170
170
* Cache Engine config
171
171
*
172
- * @return array config
173
- */
174
- public function config () {
175
- return $ this ->_config ;
172
+ * If called with no arguments, returns the full config array
173
+ * Otherwise returns the config for the specified key
174
+ *
175
+ * Usage:
176
+ * {{{
177
+ * $instance->config(); will return full config
178
+ * $instance->config('duration'); will return configured duration
179
+ * $instance->config('notset'); will return null
180
+ * }}}
181
+ *
182
+ * @param string|null $key to return
183
+ * @return mixed array or config value
184
+ */
185
+ public function config ($ key = null ) {
186
+ if ($ key === null ) {
187
+ return $ this ->_config ;
188
+ }
189
+ return isset ($ this ->_config [$ key ]) ? $ this ->_config [$ key ] : null ;
176
190
}
177
191
178
192
/**
Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ public function testGroupConfigsThrowsException() {
275
275
276
276
/**
277
277
* test that configured returns an array of the currently configured cache
278
- * settings
278
+ * config
279
279
*
280
280
* @return void
281
281
*/
Original file line number Diff line number Diff line change @@ -242,14 +242,14 @@ public function testMsgpackSerializerSetting() {
242
242
);
243
243
244
244
$ Memcached = new TestMemcachedEngine ();
245
- $ settings = array (
245
+ $ config = array (
246
246
'engine ' => 'Memcached ' ,
247
247
'servers ' => array ('127.0.0.1:11211 ' ),
248
248
'persistent ' => false ,
249
249
'serialize ' => 'msgpack '
250
250
);
251
251
252
- $ Memcached ->init ($ settings );
252
+ $ Memcached ->init ($ config );
253
253
$ this ->assertEquals (Memcached::SERIALIZER_MSGPACK , $ Memcached ->getMemcached ()->getOption (Memcached::OPT_SERIALIZER ));
254
254
}
255
255
@@ -290,7 +290,7 @@ public function testMsgpackSerializerThrowException() {
290
290
);
291
291
292
292
$ Memcached = new TestMemcachedEngine ();
293
- $ settings = array (
293
+ $ config = array (
294
294
'engine ' => 'Memcached ' ,
295
295
'servers ' => array ('127.0.0.1:11211 ' ),
296
296
'persistent ' => false ,
@@ -300,7 +300,7 @@ public function testMsgpackSerializerThrowException() {
300
300
$ this ->setExpectedException (
301
301
'Cake\Error\Exception ' , 'msgpack is not a valid serializer engine for Memcached '
302
302
);
303
- $ Memcached ->init ($ settings );
303
+ $ Memcached ->init ($ config );
304
304
}
305
305
306
306
/**
You can’t perform that action at this time.
0 commit comments