Questions tagged [cache]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
21 views

Craft 3 Cache Busting for Pending Entries

So in Craft 2 the following code was required to cache bust if an entry was set to pending or post at a future date. {% set firstPending = craft.entries({ section: 'projects', status: 'pending', ...
8
votes
2answers
3k 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?
1
vote
1answer
60 views

Deleting stale template stuck fatal memory error

So all my background tasks Craft 3.2.6 seem to process ok except deleting stale template caches. Although craft is supposed to fail after 5 minutes, it fails instantly and the error log shows ...
1
vote
1answer
57 views

How do I flush the query cache?

How do I flush Craft's query cache so that I may query a relationship field again in the same web request with a new set of parameters? In this particular scenario, I need to handle it inside of a ...
1
vote
1answer
31 views

Craft 2: What would prevent most cached template chunks from showing up in the `templatecaches` table?

I am working on a Craft 2 site that is exhibiting some rather poor performance characteristics. On production, we use memcache for caching, and monitoring on the server shows disappointing cache hit ...
1
vote
1answer
37 views

Server's IP in URLs in cached templates

I'm running Craft CMS 3.3.11 on an EC2 machine with Apache and Load Balancer. After upgrading to Craft 3, I'm having issues with caching. I use relative paths to resources/assets in my templates (...
0
votes
0answers
6 views

Use “last-editorial-change” into cache key

Is there some kind of timestamp which reflects the last overall editorial change in Craft? I would like to use this for a cache key which automatically invalidates as soon as anything (Entry, Asset, ...
1
vote
1answer
29 views

Is there a CacheService equivalent in Craft 3?

CacheService is exactly what I need to cache a custom API endpoint in PHP, but I don't see it in Craft 3. What would be the correct way to do this in Craft 3?
0
votes
0answers
12 views

Clear Cache on user profile update

Using a module, would it be possible to clear the cache of a particular user when that user updates their profile? A use case for this is we have a directory of users (authors) but if they update ...
1
vote
1answer
44 views

Using {% cache %} tags around {% template %} includes (or in Header)

I was wondering if it makes sense to wrap these {% cache %} around {% include %} tags that call a separate file with params. Is it better to just include them in the actual file itself? For example, ...
1
vote
1answer
33 views

Is it worth caching product blocks for use on a category page?

So we have a Commerce project that shows lots of products per page/category as per any standard store. Each product block comprises: Product name Product price Brand (via category field) [eager ...
1
vote
1answer
74 views

templatecachequeries entries with of 157.000 characters in query column

after enableling querycaching in craft3 I found rows in templatecachequeries with big amount of characters in the query field. I decoded it with base64 and got this as the largest entry: query_length:...
1
vote
1answer
13 views

Cache Records Being Stored for Invalid Paths

I'm trying to figure out why I have so many template cache records and when I look in my database templatecaches table I'm seeing a bunch of rows being stored for paths that don't exist. For example ...
1
vote
1answer
25 views

Why Does Manual Cache Clear Work But CP Task Fails?

I've been having a problem with my site not properly clearing out its template caches. The task list gets stuck on "Pending" when trying to execute the "Deleting stale template caches" task. If I ...
0
votes
0answers
34 views

Every time cache gets cleared, Craft requires a “Project config sync” which leaves a 503 error meanwhile

It started to happen after updating Craft's version to 3.2. This is a problem for us since we clear caches often, and sometimes it doesn't get noticed and the site is down for a while. Our Craft ...
1
vote
1answer
164 views

Generating a precache manifest for service workers

I'm thinking of using Google's Workbox to pre-cache a bunch of files, and I've been scratching my head as to how to generate unique hashes for files when they change. Something like this: workbox....
1
vote
1answer
43 views

Craft 2.6 Session Issues

We are having issues staying logged in to Craft (2.6). There was a plugin error which is what we thought was causing the issues, so we removed the sprout SEO plugin. However the error still persists. ...
0
votes
0answers
83 views

ColdCache(?) error - count(): Parameter must be an array or an object that implements Countable

I'm getting a semi-persistent error that seems to be related to coldcache. Originally on PHP 7.2.6, though also present on PHP 7.3.5. I'm experimenting with different caching approaches and my ...
1
vote
1answer
51 views

Page with Matrix field slow to load

I am fairly new to Craft CMS but have a good understanding of it. I have a page that has a Matrix field to display staff photos and their roles. On the initial load of this page, it is slow, it takes ...
1
vote
1answer
232 views

How to cache a Guzzle Http request?

In my module I have the following: $client = new Client(['base_uri' => myBaseUri]); $response = $client->request('GET', myQueryString, [ 'headers' => [ 'Accept' => ...
1
vote
1answer
64 views

Clear template cache after update sale on Craft Commerce

How can I clear products template cache after update sale ? Because product price don't change ... Thank you.
1
vote
2answers
216 views

Help setting up Memcached in Craft 3

We want to use Memcached but are struggling to find Craft 3 specific config examples and documentation. The docs mention several things that seem to lead to dead-ends: App config docs here show ...
1
vote
1answer
58 views

Redis cache memory usage

I’m runnung a few Craft sites with Redis cache enabled. It works fine. Except that Craft only uses around 3mb of Redis memory, with peaks up to 5, while there’s 128mb available. Is there a way to ...
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 %}...
1
vote
1answer
61 views

Craft update process affecting Element API cache

I have a site A using the Element API plugin to feed content to site B via JSON and handlebars templates. The process is both sites are up to date with content 'x' and it works fine. When I run the ...
2
votes
1answer
167 views

How to I set the location folder of Control Panel resources?

I'm trying to use the ./craft clear-caches/all CLI command. Everything is working fine, except that I always get this error: Error clearing cache Control Panel resources: Unable to clear Control ...
1
vote
1answer
95 views

Excluding Array of Entry Ids Not Busting Cache

-- UPDATED -- My understanding of how the cache busting works is to make sure the query is within the {% cache %} tag. When looking into how it works I may not really be understanding the ins and ...
1
vote
1answer
20 views

Craft localisation caching error

long time listener, first time caller. I'm having some issues getting localisation setup on my homestead/vagrant craft 2 site. I'm running into issues, I believe, with the craft cache when I try to ...
2
votes
1answer
869 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 ...
1
vote
0answers
74 views

Avoiding includeJsFile, includeJS from caching

In my template, I have an includeJSFile that loads properly on the first load, but disappears on subsequent loads. The includeJSFile is outside the caching tags, so I'm not sure why this is still ...
1
vote
1answer
80 views

Failed Stale Template Cache Delete Error…Analyzed…But No Answer

For some of the extremely static content on my site, I use caching to prevent multiple db queries during every single load. I also have multiple locale on my site with custom cache key names. The ...
3
votes
2answers
672 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
148 views

Craft 3 - Cache tag increasing number of database queries

I have a question about the {% cache %} tag with Craft 3. I am reading this article (https://nystudio107.com/blog/the-craft-cache-tag-in-depth), and trying out implementing the tags; however, when I ...
1
vote
1answer
73 views

Cache table filling too quickly

Have been using nystudio107 scripts to manage database workflow. Just launched first Craft 3 site and noticed that when i went to sync the database locally from server the /tmp partition on the server ...
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 ...
1
vote
1answer
149 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
150 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. ...
1
vote
0answers
182 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
131 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
203 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
39 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
14 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 ...
0
votes
1answer
266 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.
4
votes
3answers
4k views

Expected performance benefit of using a non-file CacheMethod (Redis, Memcache)

I'm wondering what kind of performance increase, and in what situations, I might expect from using Redis or Memcache over the default file-based caching. I know template caching always comes from the ...
2
votes
1answer
1k 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 ...
11
votes
4answers
5k views

Can I disable template caching for local development?

Can I disable template caching for local development? For example: setting a environmentVariable in a config file? Or is this possible in the future?
2
votes
1answer
805 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 ...
1
vote
2answers
523 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
192 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'...
4
votes
1answer
432 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
2 3 4 5