File tree 1 file changed +23
-3
lines changed 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 14
14
15
15
use Phalcon \Cache ;
16
16
use Phalcon \Cli \Task as PhTask ;
17
+ use Phalcon \Config ;
17
18
use RecursiveDirectoryIterator ;
18
19
use RecursiveIteratorIterator ;
19
20
use function in_array ;
24
25
* Class ClearcacheTask
25
26
*
26
27
* @property Cache $cache
28
+ * @property Config $config
27
29
*/
28
30
class ClearcacheTask extends PhTask
29
31
{
@@ -76,9 +78,27 @@ private function clearFileCache()
76
78
private function clearMemCached ()
77
79
{
78
80
echo 'Clearing data cache ' . PHP_EOL ;
79
- $ options = [];
80
- if (isset ($ this ->getDI ()->getShared ('config ' )->get ('cache ' )->options ->libmemcached )) {
81
- $ options = $ this ->getDI ()->getShared ('config ' )->get ('cache ' )->options ->libmemcached ;
81
+
82
+ $ default = [
83
+ 'servers ' => [
84
+ 0 => [
85
+ 'host ' => '127.0.0.1 ' ,
86
+ 'port ' => 11211 ,
87
+ 'weight ' => 100 ,
88
+ ],
89
+ ],
90
+ 'client ' => [
91
+ \Memcached::OPT_PREFIX_KEY => 'api- ' ,
92
+ ],
93
+ 'lifetime ' => 86400 ,
94
+ 'prefix ' => 'data- ' ,
95
+ ];
96
+
97
+ $ options = $ this ->config ->path ('cache.options.libmemcached ' , null );
98
+ if (true !== empty ($ options )) {
99
+ $ options = $ options ->toArray ();
100
+ } else {
101
+ $ options = $ default ;
82
102
}
83
103
84
104
$ servers = $ options ['servers ' ] ?? [];
You can’t perform that action at this time.
0 commit comments