[BUGFIX] Memcached backend identifierPrefix only based on PATH_site 21/36721/2
authorArjen Hoekema <arjenhoekema@gmail.com>
Fri, 30 Jan 2015 14:15:20 +0000 (15:15 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 6 Feb 2015 19:14:55 +0000 (20:14 +0100)
Change the 'identifierPrefix' in the MemcachedBackend so it is
caculated based on:
* PATH_site
* Context (production/developement)
* Cache identifier (cache_pages, cache_hash)

This avoids cache collisions when using a single Memcached backend
for multiple caching configurations when using the same
'entryIdentifier' in set()

Resolves: #64588
Releases: master, 6.2
Change-Id: Ib1702caa06dc29937cdc4bf574a0f05d89a8d10c
Reviewed-on: http://review.typo3.org/36721
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Cache/Backend/MemcachedBackend.php

index 6fb5d43..854eb02 100644 (file)
@@ -161,7 +161,8 @@ class MemcachedBackend extends \TYPO3\CMS\Core\Cache\Backend\AbstractBackend imp
         */
        public function setCache(\TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache) {
                parent::setCache($cache);
-               $this->identifierPrefix = 'TYPO3_' . md5(PATH_site) . '_';
+               $identifierHash = substr(md5(PATH_site . $this->context . $this->cacheIdentifier), 0, 12);
+               $this->identifierPrefix = 'TYPO3_' . $identifierHash . '_';
        }
 
        /**