diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index 69d27e9..8f9cb44 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -162,7 +162,7 @@ protected function prepareItem($cache, $allow_invalid) { public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) { // Check if maximum expiration settings for cache bin is defined if (isset($this->configuration['max_expire']) && ($expire == Cache::PERMANENT || $expire > $this->configuration['max_expire'])) { - $expire = $this->configuration['max_expire']; + $expire = REQUEST_TIME + $this->configuration['max_expire']; } Cache::validateTags($tags); $tags = array_unique($tags); diff --git a/core/modules/system/src/Tests/Cache/DatabaseBackendUnitTest.php b/core/modules/system/src/Tests/Cache/DatabaseBackendUnitTest.php index f15aef9..434d53d 100644 --- a/core/modules/system/src/Tests/Cache/DatabaseBackendUnitTest.php +++ b/core/modules/system/src/Tests/Cache/DatabaseBackendUnitTest.php @@ -58,18 +58,18 @@ public function testCacheBinExpiration(){ $backend = new DatabaseBackend($this->container->get('database'), $this->container->get('cache_tags.invalidator.checksum'), 'render', $configuration); $backend->set('test_cache1', 'foo'); $cached = $backend->get('test_cache1', true); - $this->assertIdentical($cached->expire, '2800', 'Maximum cache expire time is correct.'); + $this->assertIdentical($cached->expire, (string) (REQUEST_TIME + 2800), 'Maximum cache expire time is correct.'); $configuration = array('max_expire' => 2799); $backend = new DatabaseBackend($this->container->get('database'), $this->container->get('cache_tags.invalidator.checksum'), 'render', $configuration); $backend->set('test_cache1', 'foo'); $cached = $backend->get('test_cache1', true); - $this->assertIdentical($cached->expire, '2799', 'Maximum cache expire time is correct.'); + $this->assertIdentical($cached->expire, (string) (REQUEST_TIME + 2799), 'Maximum cache expire time is correct.'); $configuration = array('max_expire' => 2801); $backend = new DatabaseBackend($this->container->get('database'), $this->container->get('cache_tags.invalidator.checksum'), 'render', $configuration); $backend->set('test_cache1', 'foo'); $cached = $backend->get('test_cache1', true); - $this->assertIdentical($cached->expire, '2801', 'Maximum cache expire time is correct.'); + $this->assertIdentical($cached->expire, (string) (REQUEST_TIME + 2801), 'Maximum cache expire time is correct.'); } } diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index be8887c..17e8215 100755 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -697,10 +697,5 @@ * * Use this setting to set the maximum cache expiration time for a specific * cache bin in the database. - * - * For example: - * @code - * settings['cache_database']['render'] = 3600; - * @endcode */ -# $settings['cache_database'][''] = 0; +$settings['cache_database']['render'] = 604800;