Magento – Flushing REDIS Cache

block-cachecachefull-page-cacheredis

Will either of the buttons FLUSH REDIS?

enter image description here

Best Answer

The "Flush Magento Cache" button will only flush out cache records based on their tags. This uses the Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG mode when calling clean on the cache backend.

The "Flush Cache Storage" button will flush the entire cache backing (where the backend supports it), using the Zend_Cache::CLEANING_MODE_ALL mode when calling clean on the cache backend.

The Cm_Cache_Backend_Redis does differentiate between the two modes and properly handles them both.

What happens in Redis when the "Cache Storage" is flushed:

1380734058.807909 [0 127.0.0.1:61926] "flushdb"

What happens in Redis when the "Magento Cache" is flushed looks something like this...

1380733999.123304 [0 127.0.0.1:61889] "sunion" "zc:ti:541_MAGE"
1380733999.127239 [0 127.0.0.1:61889] "multi"
1380733999.127294 [0 127.0.0.1:61889] "del" "zc:k:541_APP_E4D52B98688947405EDE639E947EE03D" "zc:k:541_CORE_CACHE_OPTIONS" ... etc ...
1380733999.127493 [0 127.0.0.1:61889] "del" "zc:ti:541_MAGE"
1380733999.127523 [0 127.0.0.1:61889] "srem" "zc:tags" "541_MAGE"
1380733999.127547 [0 127.0.0.1:61889] "exec"
1380733999.128596 [0 127.0.0.1:61889] "sunion" "zc:ti:541_CONFIG"
1380733999.131160 [0 127.0.0.1:61889] "multi"
1380733999.131192 [0 127.0.0.1:61889] "del" "zc:k:541_CONFIG_GLOBAL_ADMIN" "zc:k:541_ENTERPRISE_LOGGING_CONFIG" ... etc ...
1380733999.131360 [0 127.0.0.1:61889] "del" "zc:ti:541_CONFIG"
1380733999.131379 [0 127.0.0.1:61889] "srem" "zc:tags" "541_CONFIG"
1380733999.131397 [0 127.0.0.1:61889] "exec"

You'll notice that in the first one a single command is processed by Redis vs the later example where two cache prefixes are used to delete all associated cache records. Based on what I'm seeing here (and in the code) both the '541_MAGE' and '541_CONFIG' prefixes are flushed in separate calls to the cache backend, with the config immediately following the other.

Related Topic