File tree Expand file tree Collapse file tree 1 file changed +4
-23
lines changed
src/Symfony/Component/Cache/Adapter Expand file tree Collapse file tree 1 file changed +4
-23
lines changed Original file line number Diff line number Diff line change @@ -107,14 +107,15 @@ protected function doHave($id)
107
107
return $ this ->client ->get ($ id ) !== false
108
108
|| $ this ->client ->getResultCode () === \Memcached::RES_SUCCESS ;
109
109
}
110
+
110
111
/**
111
112
* {@inheritdoc}
112
113
*/
113
114
protected function doDelete (array $ ids )
114
115
{
115
116
$ toDelete = count ($ ids );
116
- foreach (( array ) $ this ->client ->deleteMulti ($ ids ) as $ result ) {
117
- if (true === $ result || \Memcached::RES_NOTFOUND === $ result ) {
117
+ foreach ($ this ->client ->deleteMulti ($ ids ) as $ result ) {
118
+ if (\Memcached:: RES_SUCCESS === $ result || \Memcached::RES_NOTFOUND === $ result ) {
118
119
--$ toDelete ;
119
120
}
120
121
}
@@ -127,27 +128,7 @@ protected function doDelete(array $ids)
127
128
*/
128
129
protected function doClear ($ namespace )
129
130
{
130
- if (!isset ($ namespace [0 ]) || false === $ ids = $ this ->getIdsByPrefix ($ namespace )) {
131
- return $ this ->client ->flush ();
132
- }
133
-
134
- $ isCleared = true ;
135
- do {
136
- $ isCleared = $ this ->doDelete ($ ids ) && $ isCleared ;
137
- } while ($ ids = $ this ->getIdsByPrefix ($ namespace ));
138
-
139
- return $ isCleared ;
140
- }
141
-
142
- private function getIdsByPrefix ($ namespace )
143
- {
144
- if (false === $ ids = $ this ->client ->getAllKeys ()) {
145
- return false ;
146
- }
147
-
148
- return array_filter ((array ) $ ids , function ($ id ) use ($ namespace ) {
149
- return 0 === strpos ($ id , $ namespace );
150
- });
131
+ return $ this ->client ->flush ();
151
132
}
152
133
153
134
private function setOption ($ opt , $ val )
You can’t perform that action at this time.
0 commit comments