Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c46a207

Browse filesBrowse files
committed
removed extra flush logic
1 parent ed054d9 commit c46a207
Copy full SHA for c46a207

File tree

Expand file treeCollapse file tree

1 file changed

+3
-23
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-23
lines changed

‎src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php
+3-23Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ protected function doHave($id)
113113
protected function doDelete(array $ids)
114114
{
115115
$toDelete = count($ids);
116-
foreach ((array) $this->client->deleteMulti($ids) as $result) {
117-
if (true === $result || \Memcached::RES_NOTFOUND === $result) {
116+
foreach ($this->client->deleteMulti($ids) as $result) {
117+
if (\Memcached::RES_SUCCESS === $result || \Memcached::RES_NOTFOUND === $result) {
118118
--$toDelete;
119119
}
120120
}
@@ -127,27 +127,7 @@ protected function doDelete(array $ids)
127127
*/
128128
protected function doClear($namespace)
129129
{
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-
});
130+
return $this->client->flush();
151131
}
152132

153133
private function setOption($opt, $val)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.