Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1653

command line cache clear commands clear everything from caches including non Doctrine related caches

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.5
    • Fix Version/s: 2.2
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None

      Description

      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:

      1. clearing metadata cache actually clears query cache and any other Doctrine cache using the same cache driver
      2. clearing Doctrine cache of one project actually clears caches of every project using the same cache container
      3. 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');
      

        Activity

        Hide
        Howard Ha added a comment -

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

        Show
        Howard Ha added a comment - I think this issue might be resolved in 2.2 since the cache layer seems to have been rewritten.
        Hide
        Guilherme Blanco added a comment -

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

        Show
        Guilherme Blanco added a comment - To address this issue we require the rewrite that was done in 2.2. Closing as fixed.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Howard Ha
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: