Skip to content


DDC-1653: command line cache clear commands clear everything from caches including non Doctrine related caches #2296

doctrinebot opened this Issue · 3 comments

2 participants


Jira issue originally created by user redemption:

When I run doctrine orm:clear-cache:metadata I noticed that it clears everything within the cache, even items which have nothing to do with Doctrine at all.

In looking into the various driver implementations it seems that the AbstractCache->deleteAll() depends on getIds of each cache driver, yet the getIds of XcacheCache and MemcacheCache drivers seem to just get every single item within the cache.

This has several implications:

clearing metadata cache actually clears query cache and any other Doctrine cache using the same cache driver

clearing Doctrine cache of one project actually clears caches of every project using the same cache container

clearing Doctrine cache clears every object cached within that container, leading to increased risk of cache stampeding

In looking at the stored cache data it seems possible to fix #2 by using the Namespace of that project when executing a cache clear. it also seems possible to use the cache driver's deleteByRegex() to solve #1 by deleting only items listed as metadata cache vs query cache. Fixing #1 and #2 automatically fixes concern #3

Or, as an alternative, I could suggest that deleteAll() in MetaDataCommand should be replaced by:

$cacheIds = $cacheDriver->deleteBySuffix('METADATA');

Comment created by redemption:

I think this issue might be resolved in 2.2 since the cache layer seems to have been rewritten.


Comment created by @guilhermeblanco:

To address this issue we require the rewrite that was done in 2.2.
Closing as fixed.


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.2 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.