Questions tagged [cache]
254 questions
10
votes
3 answers
Why does Craft set no-cache headers for all requests?
Craft seems to be setting headers to tell the browser not to cache anything it serves, which seems bad.
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Why it do dat?
Tim Kelty
- 3,081
- 1
- 18
- 29
7
votes
2 answers
How to disable template caching? devMode isn't doing it
I'm trying to disable template caching in my development environment. I've tried a few things but thus far nothing has worked. I had thought that just setting devMode to true in the config would do the trick, but I'm still caching. The control panel…
thechrisroberts
- 73
- 1
- 5
7
votes
3 answers
Are there any file-based static cache options for Craft CMS?
Is there an option for storing the pages generated by Craft CMS as flat, static HTML files?
The model used by static driver from ExpressionEngine's CE Cache add-on works pretty well:
Each page request hits a mod_rewrite rule, which checks to see if…
Nick Benson
- 260
- 1
- 8
6
votes
2 answers
Cache tag won’t cache in a template
The image tag shown below prevents my {% cache %} tag from caching the loop it's in. If I remove the image tag or change the data-resource attribut to a normal src, it works fine. The class="lazy" and data-original are from the jQuery plugin Lazy…
Willhaus
- 201
- 1
- 9
5
votes
1 answer
Is caching the layout wrapper template a viable option?
I've been thinking about creating the simplest possible cache solution and would like to know if this is a worthwhile option.
Using the outstanding cacheflag plugin, I place the entire layout wrapper template inside these tags:
{% cacheflag flagged…
mjr
- 1,405
- 13
- 21
5
votes
1 answer
Caching queries not working as expected
I think I am not fully understanding how caching works.
Based on this answer I thought I could cache my query and then shuffle the resulting array items.
So I ended up with this code:
{% cache %}
{% set categoryProducts =…
Katrin
- 674
- 5
- 16
4
votes
2 answers
Is it possible to cache variables using the {% cache %} tag?
I would like to cache a variable and compare the cached variable with a parameter from the query string.
Is it possible to somehow cache a variable ?
{% cache using key "cacheId" %}
{% set id = 1 %}
{% endcache %}
Marco Schuler
- 620
- 3
- 13
3
votes
2 answers
{% cache %} always creates new cache data, never uses existing cached data
Why would the {% cache %} tag be storing a new cache every time the page loads (instead of just loading the existing cache)?
Unless I'm misunderstanding how caching works, the system should never record duplicate cache keys, correct?
Despite the…
Lindsey D
- 23,974
- 5
- 53
- 110
3
votes
1 answer
How does the new caching works (3.5+)
Just upgraded to Craft 3.5+ the pages are cached (instant load on a 2nd run) but the templatecaches and similar tables are empty. How exactly does it work now? How do I flush cache for 1 specific page since it's not possible to see the rows in db?
Mark H.
- 391
- 2
- 15
3
votes
1 answer
On a Archive: how could I break cache for the current year, but not the others?
I have an archive of an event based site.
I know how to break cache until the next event. No Problem
{% cache until nextEvent %}
But the archive works the following way:
archive
-- 2014 (latest year)
-- 2013
-- 2012
-- 2011
The until nextEvent…
outline4
- 595
- 3
- 14
3
votes
2 answers
Using Craft with CloudFront, and handling invalidation
I'm trying to get static assets set up to be served by CloudFront. I know how to get the S3 bucket working, and have CloudFront serving from that bucket, but what I can't wrap my head around is how to handle the invalidation. In non-Craft instances…
Megan
- 131
- 4
3
votes
1 answer
What's the difference between setting cache with {% header %} tag and {% cache %} tag?
I've came to a cache problem/question on one of my sites when I run a speed test and I failed caching test. I have very little knowledge in this area and I'd like to enhance it.
Documentation for {% header %} tag says that it set a new HTTP header…
Dominik Krulak
- 1,562
- 14
- 27
3
votes
1 answer
Is cache condition necessary to stop HTML being inserted into database cache?
We currently use cache tags with a condition referencing the cache config setting:
{% cache for 1 hour if craft.config.cache %}
Is the condition necessary to stop HTML being inserted into the database cache?
David Oliver
- 223
- 1
- 9
2
votes
1 answer
Caching and Rendering
We just have experienced a massive hit (traffic) on our site due to a campaign and have noticed that the craft caching solution is not really working well for the templates/html. We are wondering if there is anything else and how we can set it up to…
IColorfield
- 91
- 5
2
votes
1 answer
Should I use cache on data pulled from within files?
I've read documentation and it says, that We shouldn't use cache tags on static text.
I have a files, that are static in that way, that the data are pulled from within a file, or in some case, data are pulled from outside a file, where cache tags…
Dominik Krulak
- 1,562
- 14
- 27