Bug #20473

Starttime/endtime is not taken into account when caching

Added by Dmitry Dulepov about 6 years ago. Updated about 2 years ago.

Status:Closed Start date:2011-06-05
Priority:Should have Due date:
Assigned To:Steffen Gebert % Done:

100%

Category:Caching Spent time: -
Target version:-
TYPO3 Version:4.6 Is Regression:
PHP Version:5.2 Sprint Focus:
Complexity:

Description

If a content element has a starttime/endtime or a tt_news item has such dates, they are not taken into account when cached.

The attached patch solves this issue in mostly automatic way.

The related issue is #19283 but it does not solve the problem automatically but requires hooks from extensions.
(issue imported from #M11145)

cache_time.diff Magnifier (4.4 kB) Administrator Admin, 2009-05-19 10:09

cache_time_2.diff Magnifier (5 kB) Administrator Admin, 2009-05-27 20:50

11145_cache_time_v5.diff Magnifier (6.6 kB) Administrator Admin, 2010-05-28 19:16


Subtasks

Bug #27227: Use Runtime Cache in tslib_fe::get_cache_timeoutClosed


Related issues

related to Core - Feature #19283: page cache is not influenced by tt_content.starttime/endtime Closed 2008-09-03
related to Core - Bug #23180: Starttime/endtime for pages and content is not taken into... Rejected 2010-07-14

Associated revisions

Revision c759bf21
Added by Steffen Müller about 4 years ago

[FEATURE][CONF] Starttime/endtime is not taken into account when caching

If a content element has a starttime/endtime or a tt_news item has such
dates, they are not taken into account when cached.

This change adds an automatism for tt_content records. Records in other
tables can be defined as tablename:pid in TypoScript, to be taken into
account while calculating the page's cache lifetime.

Change-Id: I75479d193772905093f53fcd24299df849478fba
Resolves: #20473
Releases: 4.6
Reviewed-on: http://review.typo3.org/2393
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Stefan Neufeind
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf

History

#1 Updated by Martin Holtz about 6 years ago

i would like to have the method

setPageCacheExpiresTimestamp(...) from #19283 too.

So i would have the chance to reflact that issue in my extensions on my own. So i could take care of starttime/endtime automatically in my extensions without page-tsconfig settings. An editor would be able to put my plugin on every page without the need of additional configuration

regards,
martin

#2 Updated by Dmitry Dulepov about 6 years ago

Martin, please, discuss issue #19283 in that issue, not here.

#3 Updated by Dmitry Dulepov about 6 years ago

The second version of the patch adds caching for the calculated value and 'all' option for the cache configuration. This new option is useful when all pages depend on a record from some pages (for example, news are shown on each page of the site).

#4 Updated by Dmitry Dulepov about 5 years ago

Susanne, could you describe v5, please? What's the difference to my original versions?

#5 Updated by Zach Davis about 5 years ago

Looks like Susanne's patch takes into consideration the TS config property "cache_clearAtMidnight" whereas Dmitry's does not.

#6 Updated by Steffen Müller about 4 years ago

  • Target version deleted (0)

I'd like to pick this one up. The configuration in TypoScript would look like this:

The cache lifetime of page 42 considers the starttime/endtime of tt_news records from page 14:

config.cache.42 = tt_news:14

The cache lifetime of page 42 considers the starttime/endtime of tt_news from page 14 and tt_address records from page 15:

config.cache.42 = tt_news:14,tt_address:15

The cache lifetime of all pages consider the starttime/endtime of tt_news from page 14:

config.cache.all = tt_news:14

The cache lifetime of all pages consider the starttime/endtime of tt_news from page 14 and 16:

config.cache.all = tt_news:14,tt_news:16

#7 Updated by Mr. Hudson about 4 years ago

Patch set 1 of change I75479d193772905093f53fcd24299df849478fba has been pushed to the review server.
It is available at http://review.typo3.org/2393

#8 Updated by Mr. Hudson about 4 years ago

Patch set 2 of change I75479d193772905093f53fcd24299df849478fba has been pushed to the review server.
It is available at http://review.typo3.org/2393

#9 Updated by Steffen Müller about 4 years ago

How to test

1. Install phpmyadmin or keep mysql client ready.
2. Switch start/stop fields of fe_users from date to datetime in typo4conf/extTables.php

$GLOBALS['TCA']['fe_users']['columns']['starttime']['config']['eval'] = 'datetime';
$GLOBALS['TCA']['fe_users']['columns']['endtime']['config']['eval'] = 'datetime';

3. Create a page (uid=1) with content element.
4. Create another page (uid=2) with a fe_users record. Enter a datetime value in the stop field.
5. Add the following TypoScript to your root template:

config.cache.1 = fe_users:2

6. Render page 1 in a browser. Log off from the backend or use a second browser to create cache entry.
7. Check if there's a page cache item for the page in the cache_pages table.
7. Wait until datetime value from step 3. times out.
8. Repeat step 6.
9. Check again if the page cache item in the cache_pages table disappeared or changed.

#10 Updated by Mr. Hudson about 4 years ago

Patch set 3 of change I75479d193772905093f53fcd24299df849478fba has been pushed to the review server.
It is available at http://review.typo3.org/2393

#11 Updated by Mr. Hudson about 4 years ago

Patch set 4 of change I75479d193772905093f53fcd24299df849478fba has been pushed to the review server.
It is available at http://review.typo3.org/2393

#12 Updated by Steffen Müller about 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

#13 Updated by Steffen Gebert about 4 years ago

  • Assigned To set to Steffen Gebert
  • Target version set to 1238
  • TYPO3 Version changed from 4.2 to 4.6

#14 Updated by Steffen Gebert about 4 years ago

I've just added an entry to the Pending Documentation page. Do you think this is descriptive enough?

#15 Updated by Xavier Perseguers about 4 years ago

I may have overread it but I don't find information whether stdWrap is supported (maybe partly) or not. It could make sense to have it for edge cases but having the information (yes|no) would be worth it I guess.

#16 Updated by Xavier Perseguers over 3 years ago

  • Status changed from Resolved to Closed

#17 Updated by Ernesto Baschny about 2 years ago

  • Target version deleted (1238)

Also available in: Atom PDF