Feature #28299
closed
Add hook to tslib_fe->getHash()
Added by Fabrizio Branca almost 13 years ago.
Updated over 5 years ago.
Description
This hook enables you to modify the hash_base that is used to store
different versions of a page in the cache. Normally it is fixed to
take the id, cHash, groups and some other stuff into account, but does
not allow to add own parameters.
Using this hook you can enable to store different versions of a page
depending on other parameters than GET-parameters.
It also solves an issue that different values of linkVars will produce
the same page if used independent from TypoScript conditions and without
cHash (which otherwise should be forced for all plugins and menu generation).
Files
Patch set 1 of change I68b0cfbcbec7eee496c4f903e3a129b7f33ab7c4 has been pushed to the review server.
It is available at http://review.typo3.org/3403
Also see this post for someone (some time ago...) who needed to do the same:
http://lists.typo3.org/pipermail/typo3-dev/2006-January/014757.html
And also see this thread where someone had the same problem we faced:
http://lists.typo3.org/pipermail/typo3-german/2008-February/043915.html
The problem is that unless you have typoscript conditions set up different values of a linkvar won't result in different versions of a cached page. For languages using the "l" parameter this isn't a problem because the always come along with typoscript conditions, but for individual parameters this might not be posssible.
Besides that you could use this feature to realize some other fancy stuff like having different versions of page depending on if it is in the morning or in the evening. Or you could take session values into account.
- Status changed from New to Under Review
Patch set 2 of change I68b0cfbcbec7eee496c4f903e3a129b7f33ab7c4 has been pushed to the review server.
It is available at http://review.typo3.org/3403
Patch set 3 of change I68b0cfbcbec7eee496c4f903e3a129b7f33ab7c4 has been pushed to the review server.
It is available at http://review.typo3.org/3403
Providing a simple demo extension that implements the hook. In this case rand(0, 1) is appended to the hash providing to cached versions of a page switched randomly. The extension also provides a static template with a minimum setup displaying a timestamp.
Hit the page. Wait for a couple of seconds and hit the page again. Now refreshing the page should display the both previously generated timestamps randomly.
Hey Fabrizio,
I need a similar modification there as well. But shouldn't we unify "getHash()" and "getLockHash()" and then have one hook there? What do you think?
Patch set 4 of change I68b0cfbcbec7eee496c4f903e3a129b7f33ab7c4 has been pushed to the review server.
It is available at http://review.typo3.org/3403
Patch set 5 of change I68b0cfbcbec7eee496c4f903e3a129b7f33ab7c4 has been pushed to the review server.
It is available at http://review.typo3.org/3403
Patch set 6 of change I68b0cfbcbec7eee496c4f903e3a129b7f33ab7c4 has been pushed to the review server.
It is available at http://review.typo3.org/3403
Updated the demoextension for testing with patch set 8
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF