We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

I added tag caching to a channel:entries tag, but noticed no drop in the Queries, any ideas why?

Development and Programming

User aridHq2J's avatar
User aridHq2J
21 posts
2 weeks ago
User aridHq2J's avatar User aridHq2J

the bloqs caching dropped my Queries like I expected tag caching to

       
User BULfYYMv's avatar
User BULfYYMv
108 posts
2 weeks ago
User BULfYYMv's avatar User BULfYYMv

Yeah, I think Bloqs might escape tag cache by default

       
User BULfYYMv's avatar
User BULfYYMv
108 posts
2 weeks ago
User BULfYYMv's avatar User BULfYYMv

@litzinger can you confirm?

       
Brian Litzinger's avatar
Brian Litzinger
715 posts
2 weeks ago
Brian Litzinger's avatar Brian Litzinger

¯\_(ツ)_/¯ I don’t remember the criteria for it.

       
Brian Litzinger's avatar
Brian Litzinger
715 posts
2 weeks ago
Brian Litzinger's avatar Brian Litzinger

it creates a key from these values $cacheKey = implode('/', array_merge([$entryId, $this->field_id, 'replaceTag'], $params)); $params being anything on the bloqs tag pair, not the entries tag.

       
Brian Litzinger's avatar
Brian Litzinger
715 posts
2 weeks ago
Brian Litzinger's avatar Brian Litzinger

and should clear the cache when an entry is saved

       
User BULfYYMv's avatar
User BULfYYMv
108 posts
2 weeks ago
User BULfYYMv's avatar User BULfYYMv

Claude Says:

> This is Bloqs’ own internal output cache - not EE’s tag cache. > > Here’s what’s happening: > Default behavior: caching is OFF > isCacheEnabled() at Library/Basee/Cache.php:137 returns true only when either: > - $config[’bloqs_cache_enabled’] = true is set in your EE config, or > - cache=”yes” is passed as a tag parameter in the template (e.g. {my_bloqs_field cache="yes"}) > Since neither is set by default, caching is disabled out of the box. > > What the cache does when enabled: > When $config[’bloqs_cache_enabled’] = true, Bloqs caches its own rendered HTML output using EE’s cache driver (ee()->cache). > The cache key is entryId/fieldId/replaceTag/…params. This is entirely separate from EE’s built-in template tag cache. > On save (post_save_each hook), it busts the cache for that entry/field combo (ft.bloqs.php:622-626) > On replace_tag(), it returns the cached HTML if present, otherwise renders and saves the result (ft.bloqs.php:709-718, 758-759) > > **So to directly answer your question: ** > Bloqs doesn’t interact with or bypass EE’s tag cache at all. $config[’bloqs_cache_enabled’] = true enables Bloqs’ own separate output-level cache, which is off by default. If you’re seeing tag cache issues with Bloqs output, that’s independent of this config - it would be an EE template caching issue, not a Bloqs one.

       
User aridHq2J's avatar
User aridHq2J
21 posts
2 weeks ago
User aridHq2J's avatar User aridHq2J

the bloqs cache should be good for now, thanks for looking into things

       
User BULfYYMv's avatar
User BULfYYMv
108 posts
2 weeks ago
User BULfYYMv's avatar User BULfYYMv

Definitely was interested in the answer. Will have to try Bloqs cache again. It’s been a while.

       
User BULfYYMv's avatar
User BULfYYMv
108 posts
2 weeks ago
User BULfYYMv's avatar User BULfYYMv

There might be a gotcha with preview mode.

       
Hop Studios's avatar
Hop Studios
509 posts
2 weeks ago
Hop Studios's avatar Hop Studios

I will add - tag caching on channel:entries can only be made active if you also have the “Dynamic Channel Query Caching” setting enabled - otherwise, EE knows that channel:entries output should vary based on entry_date and expiration_date. If you are not future-dating or expiring anything, you can enable it. (The entries tag caching also checks that you’re not using author_id=”CURRENT\_USER”, handles if you’re on a paginated page, and makes sure you’re not using Dynamic Parameters, all of which would make caching the tag be problematic.)

(They could call it “I Know What I’m Doing with Caching” setting because it’s mostly meant to help folks who add cache= to their entries tag without understanding the effect of that on future entries, and I think they should get rid of it for simplicity sake.)

Most other tags, especially EE-native, don’t have variability based on the date, or if they do, EE assumes you know that when you add the cache= to the tag.

Page caching, meanwhile, caches the output of channel:entries regardless, because it doesn’t really have a way to know where what it’s caching comes from, it just caches most of the content of the page, so you see a lot of queries go away with page caching.

Preview mode shouldn’t use the cache at all, but I don’t know how it works in depth.

       
User aridHq2J's avatar
User aridHq2J
21 posts
2 weeks ago
User aridHq2J's avatar User aridHq2J

Discovered today that the bloqs caching wasn’t breaking after a content update.

       
Brian Litzinger's avatar
Brian Litzinger
715 posts
2 weeks ago
Brian Litzinger's avatar Brian Litzinger

oh rly. If you make a ticket provide as much detail as possible, video would be cool.

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.