Feature #19283

page cache is not influenced by tt_content.starttime/endtime

Added by Martin Holtz almost 7 years ago. Updated about 2 years ago.

Status:Closed Start date:2008-09-03
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:- Spent time: -
Target version:-
PHP Version:5.2 Sprint Focus:
Complexity:

Description

The actual caching meachanism works like that:

- page is generated
- expiredate is calculated (by clearAtMidNight or page caching config,
usually set to generating time + one day)
- if a page is requested, TYPO3 checks wether the cache is expired or the
page starttime/endtime should take effect.

So an content element has no influence on caching time.

If a page is cached at 2pm (with 24hours cache-expire) and there is a
content element with an starttime at 3pm on that day, that content element
will be visible first at 2pm the next day (when the page cache expires).

As an proof of concept i wrote an extension:
http://forge.typo3.org/projects/show/extension-cacheexpire

With that extension the expire-timestamp of the pagecache will be calculated based on starttime/endtime of all content elements on that page. Deleted, hidden, starttime, endtime and group-permissions are respected.

For different tables then tt_content it is possible to use an hook. With that extension i provide an very simple class which hooks in and takes care of tt_news elements (if there is a plugin on that page).

I made an patch of that extension for integrating into the core.
(issue imported from #M9284)

tslib_class.tslib_fe.php_patch.txt Magnifier (2.8 kB) Administrator Admin, 2008-09-03 22:34

9284.diff Magnifier (5.8 kB) Administrator Admin, 2008-09-09 13:36

2008.10.16.tslib_class_fe.php_patch.diff Magnifier (815 Bytes) Administrator Admin, 2008-10-16 21:55

2008.10.29.tslib_class_fe.php_patch.diff Magnifier (1.4 kB) Administrator Admin, 2008-10-29 21:06

9284-revised.diff Magnifier (1.4 kB) Administrator Admin, 2008-11-28 20:25

T3X_xnews-0_0_0-z-200811282031.t3x (5.8 kB) Administrator Admin, 2008-11-28 20:31

T3X_overlays-0_2_0-dev-z-200811282031.t3x (40.2 kB) Administrator Admin, 2008-11-28 20:32

9284-revisedv2.diff Magnifier (3.3 kB) Administrator Admin, 2010-05-28 19:15


Related issues

related to Core - Bug #20473: Starttime/endtime is not taken into account when caching Closed 2011-06-05
related to Core - Bug #23180: Starttime/endtime for pages and content is not taken into... Rejected 2010-07-14

History

#1 Updated by Martin Holtz almost 7 years ago

The new 9284.diff is from Ingo Renner in the core mailinglist

#2 Updated by Martin Holtz almost 7 years ago

another try:

i removed the hook and the sql-query and reduced this patch that it only reacts on

$GLOBALS['TSFE']->cacheExpires

#3 Updated by Martin Holtz almost 7 years ago

i uploaded another patch

this time with an additional function to set cacheExpires Timestamp

#4 Updated by Francois Suter over 6 years ago

Attaching a corrected patch, as submitted in the core list

#5 Updated by Francois Suter over 6 years ago

I have tested this patch with a quickly put together extension, which I am attaching here. The extension is called "xnews". It's a FE plugin that just gets the 10 latest records from the tt_news table (so you need tt_news installed too). There's no configuration at all. Just insert an instance of xnews on some page and display the page. You should a list of 10 news items plus an indication of when the next update should take place, i.e. when the cache will expire.

To test properly you obviously need to have at least 1 tt_news with a starttime in the future.

You can check if that matches the information stored in the cache_pages table.

The xnews extension actually relies on an (as yet) unpublished extension called "overlays" (and this is even a modified version just for testing this patch). So you need to install "overlays" too. "overlays" is used to simplify querying the DB in particular in a multilingual setup. In this case I added a method for simply getting all records in the future and calculating a precise expiry time for the cache.

#6 Updated by Dmitry Dulepov about 6 years ago

Please, see also #20473. It provides an automatic solution to this problem.

#7 Updated by Martin Holtz about 6 years ago

hi dmitry,

in my eyes
#20473
is an better approach.

#8 Updated by Xavier Perseguers about 4 years ago

  • Target version changed from 4.6.0 to 4.6.0-beta1

#9 Updated by Stefan Neufeind about 4 years ago

The functionality described in this issue-description is what #20473 (already commited now) offers. So I'd say we should close this one.

#10 Updated by Christian Kuhn about 4 years ago

  • Status changed from New to Closed

Solved with #20473

#11 Updated by Ernesto Baschny about 2 years ago

  • Target version deleted (4.6.0-beta1)

Also available in: Atom PDF