Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Evaluate possibility to control list/detail page cache #795

Closed
derhansen opened this issue Sep 18, 2020 · 3 comments
Closed

[TASK] Evaluate possibility to control list/detail page cache #795

derhansen opened this issue Sep 18, 2020 · 3 comments
Assignees
Milestone

Comments

@derhansen
Copy link
Owner

derhansen commented Sep 18, 2020

Evaluate possibility to control list/detail page cache, so registration links will not be shown when registration deadline / startdate is reached.

@christophlehmann
Copy link
Contributor

That's a very good idea. I digged into it and came to the conclusion, that is does not work at the moment.

The TypoScriptController has a hook which modifies the cache timeout, but it's executed before the extbase controller and the result is cached.

Later in TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::realPageCacheContent() is a hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['usePageCache'], but it can’t modify the cache lifetime variable.

The page cache is instantiated very early so we can not override it's configuration.

I think we need a new hook.

@derhansen
Copy link
Owner Author

I have already put some wirk into this topic and it seems that there already is a hook for that.

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['get_cache_timeout']

We can use this hook to calculate the cache lifetime depending on a TypoScript configuration similar to config.cache. The integrator has to define which PIDs should be taken into account for the page cache lifetime calculation. Then, we use getFirstTimeValueForRecord() to calculate the page cache lifetime depending on starttime/stoptime (TYPO3 default) and additionally adjust the page cache lifetime depending on the registration start date and deadline.

@derhansen derhansen self-assigned this Oct 12, 2020
@derhansen derhansen added this to the 5.2.0 milestone Oct 17, 2020
derhansen added a commit that referenced this issue Oct 18, 2020
When `config.cache` is configured properly, TYPO3 will now also respect
the start date and deadline for event registrations. This has been
implemented using the TYPO3 `get_cache_timeout` core hook.

Example configuration:

```
config.cache.3 = tx_sfeventmgt_domain_model_event:2
config.cache.4 = tx_sfeventmgt_domain_model_event:2
``

The shown example will include the starttime/stoptime and the start date
and deadline for registrations for all events in PID 2 (storage page for
events) for cache lifetime calculation of PID 3 (page with list view
plugin) and 4 (page with detail view plugin).

Refs #795
derhansen added a commit that referenced this issue Oct 18, 2020
When `config.cache` is configured properly, TYPO3 will now also respect
the start date and deadline for event registrations. This has been
implemented using the TYPO3 `get_cache_timeout` core hook.

Example configuration:

```
config.cache.3 = tx_sfeventmgt_domain_model_event:2
config.cache.4 = tx_sfeventmgt_domain_model_event:2
``

The shown example will include the starttime/stoptime and the start date
and deadline for registrations for all events in PID 2 (storage page for
events) for cache lifetime calculation of PID 3 (page with list view
plugin) and 4 (page with detail view plugin).

Refs #795
@derhansen
Copy link
Owner Author

The feature has been implemented in the development branch for version 5.x and has also been backported to the 4.x version of the extension.

derhansen added a commit that referenced this issue Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants