@@ -15,7 +15,7 @@ class RedisTreeEngine extends CacheEngine
15
15
* Redis wrapper.
16
16
*/
17
17
protected $ redis = null ;
18
-
18
+
19
19
/**
20
20
* Needs to be protected, not private since it's reset in RedisTreeMockEngine
21
21
*/
@@ -56,11 +56,19 @@ public function init($settings = array())
56
56
57
57
if (!isset ($ this ->redis )) {
58
58
try {
59
- $ this ->redis = new Predis \Client (array (
60
- 'scheme ' => 'tcp ' ,
61
- 'host ' => $ this ->settings ['server ' ],
62
- 'port ' => $ this ->settings ['port ' ],
63
- ));
59
+ if (isset ($ settings ['profile ' ])) {
60
+ $ this ->redis = new Predis \Client (array (
61
+ 'scheme ' => 'tcp ' ,
62
+ 'host ' => $ this ->settings ['server ' ],
63
+ 'port ' => $ this ->settings ['port ' ],
64
+ ), array ('profile ' => $ settings ['profile ' ]));
65
+ } else {
66
+ $ this ->redis = new Predis \Client (array (
67
+ 'scheme ' => 'tcp ' ,
68
+ 'host ' => $ this ->settings ['server ' ],
69
+ 'port ' => $ this ->settings ['port ' ],
70
+ ));
71
+ }
64
72
} catch (Exception $ e ) {
65
73
// If creation fails, return false
66
74
return false ;
@@ -308,12 +316,12 @@ public function delete($key)
308
316
private function _mdelete ($ keys )
309
317
{
310
318
$ finalKeys = array ();
311
-
319
+
312
320
foreach ($ keys as $ key ) {
313
321
// keys() is an expensive call; only call it if we need to (i.e. if there actually is a wildcard);
314
322
// the chars "?*[" seem to be the right ones to listen for according to: http://redis.io/commands/KEYS
315
323
if (preg_match ('/[\?\*\[]/ ' , $ key )) {
316
-
324
+
317
325
if ($ this ->supportsScan ) {
318
326
$ currKeys = array ();
319
327
foreach (new Iterator \Keyspace ($ this ->redis , $ key ) as $ currKey ) {
@@ -337,7 +345,7 @@ private function _mdelete($keys)
337
345
return 0 ;
338
346
}
339
347
}
340
-
348
+
341
349
/**
342
350
* Internal single-val delete.
343
351
* @param $key
@@ -383,7 +391,7 @@ public function clear($check = false)
383
391
if ($ check ) {
384
392
return true ;
385
393
}
386
-
394
+
387
395
if ($ this ->supportsScan ) {
388
396
$ keys = array ();
389
397
foreach (new Iterator \Keyspace ($ this ->redis , $ this ->settings ['prefix ' ] . '* ' ) as $ currKey ) {
0 commit comments