#2468531: tokens regenerated on every request, very slow introduced tag caching, but the implementation is broken for sites that use tokens to vary by base root, query string parameter, theme, language.
While the blocks are cached per page, the tags are cached per system path.

My use case is with the current-domain token, but perhaps a home page view that varies by language is a simple enough case.

To solve this we should either cache per page, or make this opt in. (Setting a one second lifetime is not good enough.)

Comments

Eric_A created an issue. See original summary.

eric_a’s picture

Issue summary: View changes
eric_a’s picture

Issue summary: View changes
eric_a’s picture

Status: Active » Needs review
StatusFileSize
new565 bytes

Here's an initial patch to get things going. It seems though as dfp uses a hardcoded list of data objects for token_replace(). What happens if a token is entered that needs a different object, like for example a current-domain token?

eric_a’s picture

Issue summary: View changes
eric_a’s picture

Title: Tag caching is broken (token replacement) » Wrong ads shown, tag caching broken (token replacement)
eric_a’s picture

Priority: Major » Critical

Patch works for our token.

Tokens with query parameters or pagination or absolute URL with language prefix are all broken, as far as I can see. Changing priority to critical.

bleen’s picture

Can you include a test to show a failing case?

eric_a’s picture

Can you include a test to show a failing case?

It seems that the current test classes have no dependencies. Without dependencies on token (or domain) it's pretty hard to come up with a decent test scenario.
Which required module provides a token that varies by theme, base root, language prefix? None, I guess.

Not sure how to proceed...

eric_a’s picture

StatusFileSize
new534 bytes

Here's an alternative patch that shows a fix for my Domain Access use case, with a much better cache hit ratio than the generic patch in #4.

eric_a’s picture

StatusFileSize
new534 bytes

Moved the "/ ", so that sites without domain keep the same cache ID.

bleen’s picture

Status: Needs review » Fixed

The patch in #10actually made the patch in #4 make much more sense to me ... thanks. I'm going to go ahead and commit #4 since it works in a more general case.

  • bleen18 committed 2dcc50b on 7.x-1.x authored by Eric_A
    Issue #2579259 by Eric_A: Fixed tag caching broken
    
eric_a’s picture

StatusFileSize
new1.29 KB

EDIT: Sigh, and please ignore the accidental garbage in the test file.

Thanks!

For the record: the patches in #10 and #11 are broken, for domain_get_domain() returns an array. See attached patch for a fix. (Implementation for recent versions of PHP, obviously).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.