Questions tagged [cache]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
907 views

Craft CMS 3 - Redis Sessions cause error

I've configured Redis to handle cache and sessions for Craft 3, and while cache configuration is working as expected, I had to disable session configuration due to the below error. It fails on the ...
0
votes
1answer
289 views

Cache and Pagination not working

I'm trying to get pagination and cache to work together but it's failing. Here's my current code: {% cache globally using key craft.request.path ~ '/p' ~ craft.request.getPageNum for 2 hours %}...
0
votes
1answer
283 views

What is the table `templatecachequeries` for?

What is the content of templatecachequeries table for in Craft 3? Especially the column query? And is it normal to have a lot of entries (+5000) even on a smaller medium sized page? Or it is because ...
1
vote
0answers
397 views

What are my caching options when using CraftQL and React?

I’m experimenting with the CraftQL plugin and React with Craft 3, and I’m really liking the similar syntax to standard Twig element queries, and the fact I don't need to manually configure API ...
0
votes
1answer
285 views

What files does Craft store in “craft/storage/runtime/temp”

What files does Craft store in craft/storage/runtime/temp folder. And what is the purpose of it. And how to stop it form getting huge.
1
vote
2answers
556 views

Bypass Varnish cache if user is logged in

Is it possible to bypass the Varnish cache when the user is logged in? I've tried using the "CraftSessionId" cookie, but it seems that it is also set for non logged in users.
2
votes
1answer
931 views

Caching Issue “unserialize(): Error at offset 0 of 24 bytes”

I have never gotten this before when using Craft cms this is the first. When trying to load my site (locally), I am getting this message unserialize(): Error at offset 0 of 24 bytes I have ...
1
vote
2answers
1k views

Exclude path in NGINX config (for FastCGI Caching)

I've got a Craft 2 site on an NGINX server that uses FastCGI Caching (based on Static Page Caching with Craft CMS), but I've got a few pages that have some dynamic content that I'd like to exclude ...
1
vote
2answers
51 views

Getting Template Errors When Using Cache Tag in some environments but not in others

I'm having an issue where I am getting template errors related to my craft cache tags in some environments but not others. I have my site set up on a production server that is a Linode/Forge setup. ...
0
votes
1answer
554 views

Craft 3: Enabling Memcache

Is there any configuration hint for enabling memcache in Craft 3? I'm on 3-beta-24 I added 'cacheMethod' => 'memcache', to config/general.php, but this did neither cause any hits on memcache nor ...
0
votes
1answer
252 views

Craft 3: Cache element query or variable assignment

Is it possible to cache a variable assignment and/or an element query with TWIG in Craft 3? With Yii2 this is possible, but is there a wrapper to TWIG? 2 use cases: {% set entries = craft.entries....
2
votes
1answer
221 views

How to use `{% cache %}` and `{% paginate %}` together?

When using cache tag with pagination should the tag go outside the pagination tag? {% cache %} <div class="grid-x grid-padding-x" data-equalizer data-equalize-on="medium"> {% paginate craft....
4
votes
2answers
701 views

Static page caching using Nginx FastCGI Cache with CraftCMS

This isn't Craft issue per se. But I was wondering if anyone can help me out. I’m trying to enable FastCGI Cache in my server. My nginx server block is coming from this helpful article: https://...
2
votes
1answer
100 views

Security test generated large compiled_templates directory, site outage

We just moved an installation of one of our sites to a new server. Previously, it was on a machine where the versions of Ubuntu / PHP prevented us from upgrading the Craft core version from 2.3.x to 2....
1
vote
1answer
45 views

Craft ordering tags by 'name'

I've got a problem with some tasks. Craft tells me 'Deleting Stale Template Caches Failed' multiple times. When I look in the Deprecated Warnings, it tells me two things: Ordering tags by ‘name’ has ...
2
votes
1answer
332 views

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 ...
1
vote
3answers
149 views

Newly added child entries not showing on listing/parent page straight away

I am running into an odd issue where creating new child entries does not bust the cache of the parent page(s) that lists them. This is the structure I am working with: I am displaying the Course ...
2
votes
2answers
301 views

How to Cache Globally Except for One Page

I have a template element that is used on almost every page of the site. I would like to cache that element globally, except on one particular page I would like it to just be a normal cache based on ...
1
vote
1answer
60 views

Using cache tag on array outputs nothing

Okay. I've figured it out but it left me with the question. After some page refreshes It's got stack back at empty output again. Bad: {% cache %} {% for item in orders %} {# Following variable ...
3
votes
1answer
108 views

Why if I change ie. drop down value, all entries needs to be resaved to take changes? How can I prevent it?

And why clearing cache is not enough?
6
votes
1answer
380 views

How to omit certain tag from (% cache %)

How can I omit a certain tag from being cached? I have a large page with a fair few queries but halfway down I am loading in a Freeform Form field which cannot be cached. But I'd like all of the ...
2
votes
1answer
84 views

How can I make Craft's caching aware of fields used inside a plugin?

I have a complex template which uses various modules and sub-components for which I opted for handling all the logic and rendering directly in PHP, as it felt like it was too complex a job for twig. ...
3
votes
1answer
203 views

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 {% ...
2
votes
1answer
66 views

Update content inside cache tag

Hello I am building a system in craft cms using the getharvest api. I have 'translated' the php api to support twig. The problem is the getharvest api is really slow (10+ seconds loading time) I have ...
1
vote
0answers
485 views

Craft Nginx Cache Static Resources - Css, JS Errors

I'm currently trying to cache css and js files with the widely known config as follows: location ~* \.(png|jpg|css|js|jpeg|gif|ico|xls|doc|zip|exe|mp3|mp4|pdf|ai|psd|eps|ppt|dmg|csv|key|numbers|cur|...
0
votes
0answers
44 views

Cache not outputting chunks of content

I have a simple caching setup on this site. I have a layout template that extends it has this: {% block content %} {% cache %} <p>my content</p> {% endcache %} {% endblock %}...
1
vote
0answers
400 views

craft_cache / Integrity constraint violation: 1062 Duplicate entry, Serialization failure: 1213 Deadlock

Noticing these errors a lot it my logs. Any idea why, or how to stop it from happening? Jan 27 15:02:58 myapp.com ool: myapp: [craft] [error] [system.db.CDbCommand] CDbCommand::execute() failed: ...
2
votes
1answer
191 views

'cacheDuration' => false, sets cache file expiration date to 1 year

So I noticed that by setting the 'cacheDuration' => false it seems to set, by default, the expiration date to 1 year from when the cache is saved. I found this in /app/services/...
1
vote
1answer
746 views

Caching and TTFB with Craft

I've just launched my new site here and I'm playing around with the caching options with Craft. I'm hosting my site with Siteground which gives me access to their Supercacher option, it offers Static ...
0
votes
1answer
66 views

How to update cart.lineItems while specifying HTTP cache headers?

I use the following cache system, specified in the header of all pages: {% set expiry = now|date_modify('+1 day') %} {% header "Cache-Control: max-age=" ~ expiry.timestamp %} {% header "Pragma: cache"...
0
votes
1answer
112 views

Data cached in plugin controller via CacheService won't expire

My cache won't expire. This is effectively my code: $template = (isset($params['template']) ? $params['template'].'?'.$config['pageParam'].'='.$pageParam : null); if(craft()->cache->...
1
vote
1answer
50 views

Invalidate cache from two channel expiry dates

I have two channels: A event and a news channel which I want the cache to expire based on both their expiry Date. {% set newsDate = craft.entries.section('newsDate').order('expiryDate asc').first() %}...
2
votes
2answers
391 views

Event Listener for Publishing Scheduled Posts

For performance reasons I'm caching full HTML responses to Redis. This does wonders for response times, but cache invalidation becomes a bit tricky... I'm currently purging the entire cache on '...
3
votes
3answers
2k views

Force browser to download latest CSS file

Is there any simple way to automatically add a version number when referencing a CSS file? Example: <link href="style.css?v=VERSION-HERE" rel="stylesheet" type="text/css"> Version could be a ...
2
votes
1answer
67 views

Caching ElementCriteria Lookups In Craft CMS Plugins

Two recent sites I’ve built have plugins built to handle filtering through projects based on some categories and related entries. For example the lookups look similar to this: # Get element criterea ...
1
vote
2answers
357 views

Admin pages request a broken version of the craft.css file

We’re using Craft over SSL and everything is working fine apart from the admin fonts: This is due to a mixed content, because craft.css is requesting the fonts from non-ssl URLs: The CSS file ...
2
votes
1answer
87 views

How to understand this exception error in context?

I have been trying to fine tune the performance of a heavy page: see Category query very slow on multilingual site It appears that my initial hope of getting the page under 2 seconds was not quite ...
2
votes
1answer
85 views

How to limit cache folder size

My runtime/cache folder is over 200GB in size. Is there a config setting or some way of limiting the size of the folder, rather than the cache duration? Secondly, what could cause such disk usage?
1
vote
2answers
208 views

Category query very slow on multilingual site

I have a directory of sea ports with a google map that loads about 450 records. The map and listings and pagination work fine. On their own, I get a 2.5 sec page load average. However as soon as I ...
2
votes
1answer
468 views

DeleteStaleTemplateCaches taking forever

I have a website with a few thousand entries. At the bottom of the entry template, we show 4 random news posts from the last 4 weeks. Now, when someone adds a new entry, the DeleteStaleTemplateCaches ...
3
votes
1answer
48 views

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 ...
2
votes
2answers
256 views

Error on homepage of local server no changes made since last working?

I have just gone back to a site I am working on locally to continue working on it. 2 days ago it was working fine and I have made no changes. I now have this error when I load the homepage. ...
1
vote
1answer
117 views

How can I bust a template cached plugin variable in a loop?

In my base template i set some variables like currency , currency symbol based on the IP address detected. This is done from a geolocation plugin which caches the result (ip,currency, currency symbol,...
1
vote
1answer
109 views

How to allow browsers to cache Craft's admin static files?

I notice that the Craft admin pages append random query parameters to their static files, i.e. jquery-2.2.1.min.js?x=AKVKl03So: This prevents those static files being cached in browsers, which can ...
1
vote
1answer
168 views

Cache controller/action

Does Craft have a built-in Controller/action for clearing the cache? We have auto-deployment set to a server and would be useful to set up a POST-receive hook to force the cache to clear when ...
3
votes
1answer
123 views

Define elements that bust cache on save

I wrote a little plugin that reads some entries (Events) from my events section, orders them in a calendar-like structure and returns them to be displayed in a template. (I couldn't do this twig-only) ...
1
vote
1answer
997 views

Delete Stale Template Caches tasks much larger in Production than Staging

I've been running into issues where the Delete Stale Template Caches tasks on my Production environment are running up to 20x longer than on my identical Staging environment. The config/environment ...
2
votes
2answers
707 views

Using guzzle with a plugin and cache

I've been adapting the very useful geo plugin to fetch currency and exchange rates based on a visitors IP address. [ see: https://github.com/lukeholder/craft-geo ] The plugin uses Craft's vendor ...
5
votes
1answer
170 views

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 ...
2
votes
1answer
528 views

Slow initial response time when website has been idle?

I noticed my Craft website is slower to load when it has been idle for awhile. It can take up to 3-4 seconds for the first load, and then it goes down to about 500ms (which is fine) after the first ...