Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cache]

The tag has no usage guidance.

1
vote
1answer
19 views

Mobile page support

Is there any good practice to how to serve mobile pages differently from Twig? What I would like to achieve is the following, right now we have pages like: http://myawsomecraftpage.com/stories/aaa-...
0
votes
1answer
17 views

How do you clear the templatecachequeries table?

I just noticed that on a site we launched a month ago, the templatecachequeries table is now 500mb. I'm only using the {% cache %} tag in one place on the site, around the main content matrix field. ...
0
votes
0answers
10 views

Error while sending QUERY packet. PID=881 when using cache key

If I do: {% set cacheKey = block.id %} {% cache using key cacheKey if craft.app.config.general.cache %} {% for item in items %} <div class="swiper-slide ais-hits--item" data-id="{{ ...
1
vote
1answer
32 views

Template cache table growing very big, best way to keep it in line?

So we have built a rather large site for a client, which has multiple regions, locales, user privileges, etc. Some time ago the default cache of Craft couldn't cope anymore with keeping track. The ...
1
vote
2answers
30 views

Caching question

How does the Craft CMS cache work? I want to show a certain message if the server date is between x and y. Can I do this by using an Twig if/else statement or is this cached? My code is like this: {...
1
vote
1answer
12 views

Editing a tag not reflecting on all records.. kindof

We have hundreds of entries with the improperly spelled tag "accessibilty" (the third i is missing). A search for "accessibility" will not find them (spelled correctly). I edited the tag on a record ...
1
vote
1answer
26 views

Using {% cache globally %} inside {% cache %}

I am currently building a website that consist almost entirely of blocks. There are quite a few pages that use the same blocks, but sometimes with slightly different content and not always in the ...
1
vote
1answer
114 views

Clear template cache from the CLI?

I was looking for a way to clear the “template caches” and “compiled templates” from the CLI, as I want to automatically do this after every auto-deploy of the site I've created. For this I was ...
0
votes
0answers
30 views

Craft 3 index template cached, cannot update.

So just added craft 3 on a server. I have a layout template for my head, footer etc., index template set as homepage, and a 404 page. No matter what I do, the index template will not update. The file ...
2
votes
1answer
82 views

Craft incredibly slow site performance

I am experiencing incredibly slow site performance. This extends to loading the control panel (/dashboard, /login). This only happens when I put the site on to my hosting, locally using MAMP it runs ...
2
votes
1answer
32 views

Cache not invalidating when using pagination with cache

Any idea why this code wouldn’t update/break the cache when new items are created? Think perhaps the combination of my code for pagination, cache and the ability to also break for pending entries isn'...
2
votes
1answer
63 views

Caching in Craft 3 causes out of memory when including grouped for loop

I have a problem with using {% cache %}in Craft 3, although the code runs fine without caching, and it works in Craft 2. I have narrowed the problem down to the following code: {% cache %} {% set ...
1
vote
1answer
54 views

Craft 3 Redis configuration error

when following the information for enabling Redis in Craft 3, my site just refreshes to a blank screen with a "Internal server error" generic message. Reviewing the server logs reveals: ...
1
vote
0answers
42 views

Caching matrix that contains Freeform field

I've got a matrix block that most pages on my site are built from, and one of its blocks is a Solspace Freeform form field. I want to be able to cache the entire output of the matrix, but that makes ...
0
votes
0answers
96 views

Craft 3 Cache To HTML

So the site I am dealing with is heavy load, lots of records and looping through a matrix records on top of it all. Everything about it, is slow, just because, not a Craft thing but a data thing. I ...
0
votes
1answer
124 views

Failed to load Twig template “_includes/field”, index “764771142”: cache is corrupted

Making first steps with Craft CMS, and it's great, but there is one thing i can't figure out: When trying to add a new entry with a rather complex set of fields (including matrix) there is an error: ...
0
votes
0answers
10 views

How to cache location per guest in craft cache via plugin

I am looking at setting the currency of a guest site visitor. I have the look up and currency retrieval working OK based on the individuals IP. The problem i seem to face is how to cache the currency ...
2
votes
1answer
201 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
93 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
63 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
185 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
0answers
68 views

Cloudfront full site delivery help

I'm attempting to serve our craft cms site fully via cloudfront. I understand the concept of the caching behaviors, but am struggling to get logged into the admin. My first behavior (rule) cloudfront ...
0
votes
1answer
97 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.
0
votes
0answers
18 views

Does the cache “for” parameter delete old caches?

As the questions asks. I'm using the coldcache plugin instead of the normal cache and I've set the for parameter to 5 secs. for 5 secs But when I reload after 5 secs, a new cache is generated with a ...
0
votes
0answers
141 views

Cannot resolve “Deleting stale template caches” getting stalled

I'm out of ideas here. I have made a website for a client which has a lot of entries with each having a lot of fields (including a lot of matrix and neo fields). And the "Deleting stale template ...
0
votes
0answers
134 views

Template cache not clearing when a new entry is added

I have a custom element when I add a new entry to it the template cache doesn't clear and doesn't display the newly added entry But when I edit an existing one it does clear the cache and displays ...
1
vote
2answers
185 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.
1
vote
1answer
309 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
525 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 ...
0
votes
0answers
49 views

Globals variable caching

I am updating a globals variable and am not seeing it update my page. I went into settings and cleared caches, but I'm still not seeing the variable update. If I make the same change in my dev/test ...
1
vote
2answers
36 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
356 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
158 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....
1
vote
1answer
150 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....
3
votes
1answer
422 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
65 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
37 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 ...
1
vote
1answer
151 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
87 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 ...
3
votes
2answers
152 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
49 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 ...
4
votes
1answer
59 views
5
votes
1answer
189 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
64 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
140 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
60 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
400 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
34 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
205 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: ...
3
votes
1answer
122 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/...