Skip to content

symfony - cache - memcached - key versionning #28445

@soleuu

Description

@soleuu

Symfony version(s) affected: >=3.3

Description
Implementation of MemcachedAdapter use "key versionning" (see MemcachedTrait::init)
Implementation of version in cache/Adapter/AbstractAdapter.php use 1 key for global versionning.
This implementation is like tagging witch is not advised with memcached. (see constructor comment on Symfony\Component\Cache\Adapter\MemcachedAdapter)

The problem here is : what happen when the versionning key expires or is evicted from cache ?
Response : we get older version of cache !

I clearly understand why the actual implementation is interresting on shared memcached : we simply invalidate key for the application without flushing cache of other application. But versionning in that context should be an option and should not be activated by default.

How to reproduce

  • store some key on memcached
  • flush the cache with symfony command line
  • store different values on same key
  • manually delete the version key to simulate LRU or eviction
  • now you should get old version of your memcached keys

Possible Solution
MemcachedAdapter should not use versionning !
Memcached shoud flush the cache when clear command is called !
Or
add option to activate/inactivate key versionning
=> need to flush when versionning is off

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions