From ba0c434bc5c4fd9381afa99aa6b59143c61f283f Mon Sep 17 00:00:00 2001 From: Oliver Hader Date: Sun, 29 Nov 2009 13:21:28 +0000 Subject: [PATCH] Fixed bug #11326: Memcached backend does not work well if cache of a page shall expire after 30 days git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6577 709f56b5-9817-0410-a4d7-c38de5d9e867 --- ChangeLog | 1 + .../cache/backend/class.t3lib_cache_backend_apcbackend.php | 3 --- .../backend/class.t3lib_cache_backend_memcachedbackend.php | 6 ++++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2af94b98e92..50217143913e 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ * Fixed bug #12786: Wrong mouseover cursor at icon of docheader (thanks to Georg Ringer) * Fixed bug #12792: Unit test checkGetExtensionKeyByPrefix of the t3lib_extmgm_testcase fails + * Fixed bug #11326: Memcached backend does not work well if cache of a page shall expire after 30 days (thanks to Vladimir Podkovanov) 2009-11-26 Francois Suter diff --git a/t3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php b/t3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php index 42e065672f19..3f447dacacd3 100644 --- a/t3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php +++ b/t3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php @@ -81,9 +81,6 @@ class t3lib_cache_backend_ApcBackend extends t3lib_cache_backend_AbstractBackend /** * Saves data in the cache. * - * Note on lifetime: the number of seconds may not exceed 2592000 (30 days), - * otherwise it is interpreted as a UNIX timestamp (seconds since epoch). - * * @param string $entryIdentifier An identifier for this specific cache entry * @param string $data The data to be stored * @param array $tags Tags to associate with this cache entry diff --git a/t3lib/cache/backend/class.t3lib_cache_backend_memcachedbackend.php b/t3lib/cache/backend/class.t3lib_cache_backend_memcachedbackend.php index b5a6660e65f8..6f73a28da666 100644 --- a/t3lib/cache/backend/class.t3lib_cache_backend_memcachedbackend.php +++ b/t3lib/cache/backend/class.t3lib_cache_backend_memcachedbackend.php @@ -224,6 +224,12 @@ class t3lib_cache_backend_MemcachedBackend extends t3lib_cache_backend_AbstractB $tags[] = '%MEMCACHEBE%' . $this->cache->getIdentifier(); $expiration = $lifetime !== NULL ? $lifetime : $this->defaultLifetime; + // Memcached consideres values over 2592000 sec (30 days) as UNIX timestamp + // thus $expiration should be converted from lifetime to UNIX timestamp + if ($expiration > 2592000) { + $expiration += $GLOBALS['EXEC_TIME']; + } + try { if(strlen($data) > self::MAX_BUCKET_SIZE) { $data = str_split($data, 1024 * 1000); -- 2.20.1