Skip to main content

Questions tagged [cache]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
2k views

How can I keep the Compiled Templates from caching during development?

I'm currently developing some templates in Craft. My work flow is > Make a change to the template file > Save the file, which automatically loads to the server > Reload a test page in a web ...
Jack McKenzie's user avatar
2 votes
1 answer
537 views

Cache entry but escape dynamic data

How can I cache an entry, lets say a product card but exclude an dynamic part? Like amount of favorites / Or link to add or remove to favorite. {% set item = craft.shortlist.item(entry.id) %} {% ...
Johannes Lamers's user avatar
2 votes
2 answers
1k views

Busting Craft Cache

I've been looking around and can't seem to find anything, maybe it's not possible. For a forum plugin I'm toying with, topics use more data outside of the page in craft's db, so I need a way to bust ...
taylor's user avatar
  • 1,128
0 votes
0 answers
49 views

Can you store cropped cloud assets locally?

Currently I'm seeing them cropped and stored on the remote bucket. Is there a way to force them to be stored locally and retrievable via an Asset URL method?
Russ Back's user avatar
  • 1,503
1 vote
1 answer
196 views

expiryDate in craft_templatecaches

I've found this in the documenation: Dates and times are both formatted for the user’s preferred locale. They are displayed in the site’s timezone, however they get stored in UTC like all other ...
Christian Steger's user avatar
1 vote
1 answer
272 views

Measuring Template Performance

I've got a news website built and I am in the process of improving it's performance. What would be the best way to measure the performance of my templates? I can use Chrome Developer tools to measure ...
cballenar's user avatar
  • 1,409
6 votes
1 answer
724 views

Cache/ColdCache & checking for ungenerated image transforms

This issue is very similar to the following issue, but this goes a little bit further. Cache tag won’t cache in a template I have a page which is made up of hundreds of lazy loaded images similarly ...
Johan Douma's user avatar
0 votes
1 answer
97 views

Are caches saved per locale by default?

Or do we need to set a specific key that includes something unique?
Russ Back's user avatar
  • 1,503
3 votes
1 answer
1k views

DeleteStaleTemplateCaches job getting stuck

We have only two templates leveraging the cache tag and they both have a construct similar to: {% extends "_layout" %} {% block content %} {% cache globally using key entry.url ~ "relatedArticles" ...
Mathieu P.'s user avatar
2 votes
2 answers
242 views

Cache HTTP and HTTPS seperately using {% cache %}

we have a page that can be accessed both via regular HTTP and HTTPS. We now stumbled across an issue that if a page has been loaded via HTTP (and the content has thus been cached) and another user ...
Clemens Sum's user avatar
3 votes
2 answers
568 views

{% 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 ...
Lindsey D's user avatar
  • 24k
2 votes
1 answer
190 views

Why is using the cache tag more expensive than outputting static text?

The Craft docs have a good overview of the {% cache %} tag. The docs give a couple examples of when not to use the {% cache %} tag. In particular, they give this example: Don’t use them to cache ...
Ben Parizek's user avatar
  • 13.5k
2 votes
0 answers
187 views

Cache not invalidating when new entry is created

I realise this is probably a duplicate of the other questions just like it but I thought I'd raise it here before filing a bug with P&T. Basically, when a new entry is added to a section, the ...
hamishtaplin's user avatar
22 votes
1 answer
2k views

How does template caching work?

The {% cache %} tag is quite powerful, and can be used to greatly increase the performance of templates. But ultimately the whole thing is still pretty mysterious. I can see three tables in the ...
Lindsey D's user avatar
  • 24k
4 votes
1 answer
1k views

Cacheing in PHP code for plugin

I have a plugin that makes several and potentially slow database calls that eventually return 8 Entries. Is there a way to make use of Craft's built in caching on the plugin side? Using the {% cache %}...
Aaron Berkowitz's user avatar
3 votes
2 answers
2k views

Manually clean database cache

Is it possible to manually clean the database caches for templates? Doing it from the CP becomes stuck.
Florian's user avatar
  • 428
1 vote
2 answers
580 views

Caching variables for use elsewhere in a template?

I have a long if/else block within a for loop in my template and I wanted to cache all of it (it loops over a Matrix field, checking for different block types on each row and outputs the correct code ...
Mike's user avatar
  • 719
2 votes
3 answers
201 views

Automatic cache clearing when reordering custom element type

I've developed a custom menus plugin which has been working great https://github.com/familiar-studio/craft-menus Im trying to get it work with the build in template caching and realizing the reorder ...
Keith Mancuso's user avatar
2 votes
1 answer
915 views

Redis Enviornment Specific DB's

I'm not entirely well versed in how Redis works, but I have an idea that it probably makes the most sense to have the 3 craft sites I have running on the same server, have 3 different redis databases ...
Seán O'Grady's user avatar
3 votes
1 answer
894 views

Caching and Memory problems. What is best caching method

I'm working on a website for a music / artist agency. On the homepage we need al the artist entries. More than 200. Each artist profile has an image, an image color extruder picker, some tags, ...
Johannes Lamers's user avatar
2 votes
1 answer
319 views

Cache not invalidated on publishing new entry

I'm using {% cache %} to cache pages, but it seems that the caches are not invalidated after posting new content, which is what I thought should happen. I've investigated the situation and what I ...
Daniel's user avatar
  • 343
1 vote
1 answer
294 views

Cache closing tag error

I'm trying to using craft caching to cache a page without query string vars. This tag {% cache using key craft.request.path %} {% endcache %} throws an error Unexpected token "name" of value "...
Derrick Grigg's user avatar
2 votes
1 answer
452 views

Caching tables not clearing out

We are running Craft on a site that gets a decent level of traffic, thousands of hits per day. We are running craft caching to try and keep things quick. The caching tables have been growing ...
Derrick Grigg's user avatar
0 votes
1 answer
122 views

Cache Not Invalidating

Im using a pretty standard method for calling for entries, but with one small caveat in that I'm setting the limit inside a variable which is passed through to an include so my index.twig file is ...
Seán O'Grady's user avatar
6 votes
1 answer
2k views

Adding active class to globally cached navigation

I have a structure which controls my main site navigation. It's the same across the site so it is best to cache globally as opposed to a cache of the navigation or every url. The last answer on this ...
mmc501's user avatar
  • 1,789
2 votes
1 answer
726 views

Config variable does not exist

I'm trying to set up caching and have it disabled for my local environment using {% cache unless craft.config.devMode %}. This works fine on non-local environments, but on my local environment I'm ...
KeironLowe's user avatar
4 votes
1 answer
2k views

When does Craft change or delete template caches?

My question is regarding template caching in Craft. I want to know when does Craft actually change the cache or delete old cache. Let's say that I am caching a chunk that just displays the entry ...
Moin Qidwai's user avatar
1 vote
1 answer
706 views

Use cache instead of saving to database

With my plugin I am generating and saving a lot of data to a secondary table. Data that can be generated on the fly that is associated with entries. I have noticed a performance hit and was given a ...
a-am's user avatar
  • 2,857
3 votes
1 answer
906 views

Can random be used for ordering with related/assets, in cached code?

I'm trying to determine if I can update this: {% cache %} [ {% set tags = craft.tags.group('color','season','style','venue').limit(null) %} {% for image in craft.assets.relatedTo(tags).order('...
Mark J. Reeves's user avatar
6 votes
1 answer
1k views

How to fix "ambiguous" column error generated when DeleteStaleTemplateCaches is run?

Following up on: Deleting Stale Template Caches Failed Here's what I'm assuming is the tag throwing the error in the DeleteStaleTemplateCaches task. How would I disambiguate this? I'm not sure ...
Mark J. Reeves's user avatar
1 vote
1 answer
154 views

Caching and related Entries

I'm currently working on integration some caching behaviour using {% cache %} tags. This works mostly just fine, but I have some issues when I work with related entries. For example I have a list of ...
Pascal Mollet's user avatar
3 votes
1 answer
2k views

Deleting Stale Template Caches Failed

I continue to see these pile up. If I clear my template cache, I can hit retry on each and they go away, but that's getting tedious. I have the following from a P&T support request on these a ...
Mark J. Reeves's user avatar
2 votes
1 answer
201 views

How much data can craft()->cache hold?

How much data can I push into one craft()->cache key? Let's say I have a json string that's reaaaallly long.
naboovalley's user avatar
  • 2,844
5 votes
1 answer
16k views

Adding cache headers to Nginx configuation file breaks the /admin area

When I add this to my Nginx Confirguration file: location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires 7d; add_header Pragma "public"; add_header Cache-Control "public, must-revalidate, ...
Jason D's user avatar
  • 1,132
1 vote
1 answer
223 views

Does the cache tag behave differently for Mobile vs Tablet vs Desktop?

Are different cache saved for Mobile / Tablet / localisations or do we have to take care of this? I.e. if i use: {% if craft.request.isMobileBrowser() %} will the response be cached for desktop ...
nexflo's user avatar
  • 539
4 votes
1 answer
543 views

How can I time-profile the page load for a Craft request?

I would like to see how long plugins take to load, as well as other aspects of the page (loops and database requests). My webpage can take ~2-3 seconds to return the initial request. It seems high ...
Jason D's user avatar
  • 1,132
1 vote
0 answers
219 views

Performance and cache when using entry type templates and getSegment

I'm working on a site that will end up having 30-40+ structure sections which are sharing templates and will be using about 10 different entry types. (This would probably be much easier if I used ...
Paul's user avatar
  • 339
6 votes
1 answer
2k views

Varnish 4.x and Craft

Is there any vcl file to use with Craft? I saw here an amazing answer about Varnish and Craft and there is a 3.x configuration file but i need a newer one for Varnish 4 and i don’t know Varnish ...
mbalparda's user avatar
  • 647
10 votes
2 answers
11k views

Is it possible to clear caches and re-index assets programattically?

When migrating a Craft site, I'm used to... deploying files checking my config, tweaking as necessary loading a database backup running "Update Asset Indexes" and "Clear Caches" from the control ...
Matt Stein's user avatar
  • 4,006
1 vote
1 answer
518 views

Configure Memcache per environment

Is there any way to add memcache servers to use per environment? I mean, one server for dev, one for staging and one for production.
mbalparda's user avatar
  • 647
1 vote
1 answer
204 views

Craft URLs intermittently being cached as /index.php/my-page/ or /index.php?p=my-page

Cross-posting from here, as I'm not sure if this is a Craft issue or specific to the cache-clear plugin. Intermittently (twice in a day now), I've seen templates being cached with Craft URLs ...
Tim Kelty's user avatar
  • 3,081
10 votes
3 answers
4k views

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's user avatar
  • 3,081
9 votes
1 answer
1k views

Is there a way to override the template caching system?

We're in the process of building a restfull backend in craft. We had sluggish response times due to the amount of queries done by craft on a an entry listing. Each entry had about 3 levels of nesting ...
pythic's user avatar
  • 569
3 votes
1 answer
159 views

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 ...
outline4's user avatar
  • 595
25 votes
1 answer
5k views

Generating pending image transforms stuck in process

In the CMS the progress indicator for tasks is stuck and not completing its jobs. What can I do to resolve this?
a-am's user avatar
  • 2,857
3 votes
1 answer
197 views

Does it make sense to cache a Global?

I have a global that consists of 1 rich text field and the content is displayed on every page. Does it make sense to cache that? If so, I am assuming it should be cached globally?
Jacob Graf's user avatar
2 votes
2 answers
443 views

How to cache content per user?

Is there a way to cache content with the (% cache %} tag on a per-user base? If user A is logged in, his content gets cached. User B logs in, but his content should not interfere with that of User A.
Paul's user avatar
  • 6,338
4 votes
1 answer
311 views

Cached entries and postDate / expirationDate [duplicate]

How does the {% cache %} tag handle a situation where an entry reaches its post date or expires?
Ian's user avatar
  • 564
3 votes
1 answer
2k views

Long 'Deleting stale template caches'

Is it common to have a (near)constantly running 'Deleting stale template caches' task ongoing? I commonly log in to see a task still pending several hours after the last change to the site was made, ...
Darren's user avatar
  • 433