As part of #2124957: Replace 'content' cache tag with 'rendered' and use it sparingly, we added standardized cache tags to all entities in #2217749: Entity base class should provide standardized cache tags and built-in invalidation (with test coverage).

tour.module's Tour config entity type affects rendered content: that for users with the permission to use tours. Let's set the appropriate cache tags and add basic test coverage.

Since this typically only affects authenticated users, the importance of this issue is lower.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Status: Active » Needs review
Issue tags: +Needs tests, +Novice
FileSize
643 bytes
Wim Leers’s picture

Status: Needs review » Needs work
Wim Leers’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests, -Novice
Related issues: +#2241275: DateFormat cache tag: don't set the cache tag, but invalidate the entire render cache?
FileSize
4.28 KB

On second thought, I think that a similar approach as the one in #2241275: DateFormat cache tag: don't set the cache tag, but invalidate the entire render cache? is applicable here.

Just like Date Formats, Tours rarely change. When they do, they will usually arrive via a module update, and when a module is updated, all caches are cleared anyway. That makes the case for using the array('rendered' => TRUE') cache tag.

However, tours are only added at the page level, so tours setting cache tags will only affect page cache items, so not "almost every render cache item", as was the case for Date Formats.
Hence making tour entities set the array('rendered' => TRUE) cache tag would invalidate all render cache entries, even though we'd really only need to invalidate page render cache items. That's unnecessary.
Hence I think we might want to have a single cache tag for all tours (so array('tour' => TRUE)), rather than one per tour. That:

  • keeps the number of cache tags low
  • keeps high cache hit ratios (because low cache invalidation ratios) for all non-page render cache items
  • still guarantees instantaneous cache invalidation thanks to cache tags, which we don't have right now
Wim Leers’s picture

Issue tags: +sprint
moshe weitzman’s picture

I don't really see the bloat problem with an additional tour-n tag indicating a given tour. I foresee tour changes that happen via a UI instead of code deploy and it would be a shame to flush all pages containing any tour when the tour that was edited has not even been added to a page yet.

nick_schuch’s picture

Moshe is right, we've got a basic prototype of a Tour UI in contrib that will be fleshed out once we hit a BETA. If we could keep the "tour-n" tag that would be awesome!

Wim Leers’s picture

Status: Needs review » Needs work

D'oh! Of course! I totally forgot about the "build tours in UI" use case.

I will update the patch.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
5.53 KB
3.03 KB

Et voilà.

Status: Needs review » Needs work

The last submitted patch, 8: tour_cache_tags-2241267-8.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Needs review
FileSize
4.44 KB

Oops, bad patch. Better patch attached. Interdiff in #8 was correct.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 650bc9f and pushed to 8.0.x. Thanks!

  • alexpott committed 650bc9f on 8.0.x
    Issue #2241267 by Wim Leers: Make tours set cache tags.
    
Wim Leers’s picture

Issue tags: -sprint

Status: Fixed » Closed (fixed)

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