Project

General

Profile

Actions

Bug #82380

closed

cache_clearAtMidnight wrong calculation of midnight

Added by Heinz Schilling about 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2017-09-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

In typo3 > sysext > frontend > Classes > Controller > TypoScriptFrontendController.php function get_cache_timeout() midnight is calculated by adding $cacheTimeout.

Line 4461:

$timeOutTime = $GLOBALS['EXEC_TIME'] + $cacheTimeout;

If config.cache_period > 86400 then midnight is far in the future. Cache for page with UID = 20 will clear at midnight in 7 days.

Example:

config.cache_period = 604800. 
[globalVar = TSFE:id = 20]
    config.cache_clearAtMidnight = 1
[GLOBAL]

Possible solution in line 4461:

$timeOutTime = $GLOBALS['EXEC_TIME'] + 86400;

Actions #1

Updated by Felix Nagel about 7 years ago

Seems I run into this issue in one of my projects (TYPO3 8.7.8).

When I understand this correct, using

config.cache_period = 86400

in addition to cache_clearAtMidnight should be a working temp fix, right?

Actions #2

Updated by Heinz Schilling about 7 years ago

config.cache_period = 86400

is default value in TYPO3 7.6 LTS. Maybe in TYPO3 8.7 LTS too. If you don't change this value you can use
config.cache_clearAtMidnight = 1

without errors. For further discuss switch to stackoverflow.
Actions #3

Updated by Susanne Moog over 4 years ago

  • Status changed from New to Closed

This basically works as advertised, see https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Setup/Config/Index.html#cache-clearatmidnight

"With this setting the cache always expires at midnight of the day, the page is scheduled to expire." -> so it should not expire at the next possible midnight, but exactly like it does: midnight on the day the page would expire (idea is to avoid clearing cache during main business hours).

Actions

Also available in: Atom PDF