Questions tagged [cache]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
9
votes
2answers
1k views

How do I cache with the ElementAPI plugin?

I'm replacing some templates with the ElementAPI plugin. In my templates, I would use the cache tag, and rely on Craft to handle invalidation when the elements changed. How can I achieve a similar ...
1
vote
2answers
187 views

Can Craft or any of its plugins render down flat html files for speed

Having spoken to our 'ops guy' I've come to understand that if Craft CMS can render flat html or cache some of the pages then it makes thing a lot quicker to load etc. Is this something craft can do? ...
2
votes
1answer
2k views

Nginx FastCGI caching NO PROXY

We are implementing fast CGI cache (not not the proxy version) but it seems that our upstream cache hit is always MISS. If we hijack public/index.php by not running require_once($craftPath."/vendor/...
3
votes
1answer
524 views

Massive template cache cleaning tasks always get stuck

We have a site where we use lots of {% cache %} tags. Now we almost constantly have a "cleaning template cache" task running, and they often get stuck. Manual DB intervention and resetting the ...
4
votes
1answer
509 views

Troubleshooting paginated content cached globally

Looks like caching paginated content globally forces any following pages (p2,p3, etc) to just echo the same content as the first page. Using a regular cache tag works as desired, but I don't want to ...
2
votes
2answers
711 views

Error while sending QUERY packet

I have a includeJS variable set that populates a javascript calendar from an entries loop, with a large amount of entries which needs to be cached. Whenever I cache this section I get this error: ...
1
vote
0answers
419 views

Set Cache-Control is being overridden

We are setting our Cache-Control headers in the layout file for all templates. However some templates the Cache-Control is being overridden. Why might this be? {% set expiry = now|date_modify('+10 ...
3
votes
1answer
439 views

Is it possible to cache a faceted search form?

I have created a search form which allows user to search multiple categories groups and multiple categories within those groups. So I have Type [] Category 1 [x] Category 2 [] Category 3 ... ...
4
votes
1answer
546 views

How can I mitigate caching performance issues with Craft?

I ran into problems with the performance of one of our Craft sites. This showed up as: MySQL running out of memory and crashing, because Apache was using up all the memory in backgrounds tasks, ...
1
vote
0answers
214 views

Limit fields in query / Optimize query

What I'm doing is fairly simple: {% cache %} {% set jobs = craft.entries.section('job').find({ order: 'dateCreated asc', limit: 0 }) %} {% for job in jobs %} {{ macros.jobProfile(job) ...
2
votes
1answer
100 views

How can I get the same element ids that the DeleteStaleTemplateCaches Task ends up with before the element has saved?

I recently made a plugin that tries to keep the existing cache warm. It does this by listening to the elements.onBeforeSaveElement event, grabbing the id of that element and finding all the paths in ...
1
vote
1answer
551 views

Best Caching strategy

Part of our go live process is to put caching in place for the site. It is a great feature. But I am unsure on the best strategy, not from a technical perspective but from a non-technical cms editor ...
4
votes
3answers
683 views

Template Hook + Caching

A portion of my template is being cached, using the standard cache tag: {% cache %} Within that cached section of the template, I'm using a template hook: {% hook 'myTemplateHook' %} Within that ...
7
votes
3answers
2k views

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 ...
1
vote
1answer
148 views

sessions being read inconsistently

I've got a navigation bar that displays different links for logged in users using {% if currentUser %}. However, when clicking through links, sometimes it won't pick up that someone is logged in. The ...
2
votes
1answer
134 views

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 ...
1
vote
1answer
252 views

Possible cache issue? Not sure

I have a very simple plugin to update a user's name. All I'm doing is: $userId = craft()->userSession->id; $user = craft()->users->getUserById($userId); $post = craft()->...
0
votes
1answer
120 views

How is appID used in caching?

I want to ensure that cache is set per domain at a config level. So rather than saying something like this in the template: {% cache using key craft.config.getHostInfo ~ '.' ~ entry.slug ~ '....
4
votes
3answers
861 views

Cache issues making site super slow in production but not in dev mode

We have a site that is performing very poorly with very long load times and I'm guessing it may be related to caching but have no idea how/why. The site's homepage was loading very slowly while in ...
7
votes
2answers
2k views

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 ...
6
votes
1answer
391 views

What effect does nesting cache tags have?

What effect, if any, does nesting cache tags have? It seems like it would be redundant, but are there any inherent drawbacks? Recently, I can across an instance where I was using the {% cache %} tag ...
2
votes
1answer
91 views

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 ...
1
vote
2answers
1k 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 ...
2
votes
1answer
480 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) %} {% ...
2
votes
2answers
953 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 ...
0
votes
0answers
46 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?
1
vote
1answer
148 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 ...
1
vote
1answer
248 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 ...
6
votes
1answer
570 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 ...
0
votes
1answer
94 views

Are caches saved per locale by default?

Or do we need to set a specific key that includes something unique?
3
votes
1answer
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" ...
2
votes
2answers
233 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 ...
3
votes
2answers
450 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 ...
2
votes
1answer
179 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 ...
2
votes
0answers
175 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 ...
22
votes
1answer
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 ...
4
votes
1answer
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 %}...
3
votes
2answers
2k views

Manually clean database cache

Is it possible to manually clean the database caches for templates? Doing it from the CP becomes stuck.
1
vote
2answers
483 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 ...
2
votes
3answers
165 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 ...
2
votes
1answer
874 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 ...
3
votes
1answer
871 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, ...
2
votes
1answer
277 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 ...
1
vote
1answer
274 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 "...
2
votes
1answer
404 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 ...
0
votes
1answer
110 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 ...
6
votes
1answer
1k 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 ...
2
votes
1answer
615 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 ...