Questions tagged [cache]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

Recommended Redis data eviction policy for Craft CMS

I have recently switched from memcached to Redis. The cache, session, template caching and mutex is now using Redis on a project. While Redis generally gets managed by Yii/Craft CMS, Redis features a ...
  • 1,041
2 votes
2 answers
90 views

Recommended caches to clear after server deployments?

Craft has this article about deployment best practices: https://craftcms.com/knowledge-base/deployment-best-practices It also states that you might want to clear caches after deployments, which is of ...
0 votes
0 answers
41 views

Craft creating over 250.000 cache files

My Craft CMS 3.7.38 is creating over 250.000 almost identical cache files inside the /storage/runtime/cache/-folder. Because the website isn't even a frequently used big platform, I have no idea why ...
  • 121
2 votes
1 answer
58 views

Disable template cache globally based on condition

I'm looking for a way to disable the template cache ({% cache %} tags) for the entire request based on a specific condition (not just based on the current environment). In this case, the condition is ...
  • 6,925
3 votes
2 answers
89 views

How do you deal with random class and cache?

I recently started using tailwindcss and I generate random classes via the function random() and get "text-nature", "bg-nature", bg-nature-light", "text-culture", &...
0 votes
0 answers
18 views

Is it possible to invalidate the GraphQL cache for a single query?

I have a pretty large website that benefits greatly from the GraphQL cache, but it seems like it's a single site-wide config in the Craft config/app.php file. I would need to invalidate the cache from ...
1 vote
1 answer
131 views

Upgrading to 3.7.26 causes tempnam() error from twig's FilesystemCache.php

I am upgrading a Craft project that I have been neglecting for a little bit too long. I am upgrading to 3.7.26 from 3.4.25; on top of this, I am upgrading from PHP 7.1 to PHP 7.4. I'm also updating a ...
0 votes
0 answers
19 views

How can I stop a user registration thank you page being cached in Craft 2

I seem to have an issue with a thank you page on user registration in craft 2. The thank you page gets passed a modified users id which is shown to the the registrant. However some odd occasions have ...
  • 1,900
1 vote
1 answer
55 views

file based cache and runtime files in load-balanced environments

We are currently setting up 2 Craft webservers behind a load balancer with sticky sessions. What I am wondering: Is there any need, that the file based cache needs to be somehow switched to a shared ...
1 vote
1 answer
70 views

Cache Excesive Assets Size

I have only been using Craft 3 for a short time and I am currently the webmaster of a too big news site. I just checked that the /storage folder is almost 80GB in size. All the size is in the /storage ...
  • 13
1 vote
1 answer
87 views

New assets field not showing up for some users

I've added an assets field to an existing channel that shows up fine for me on both the new entry and editing existing entries, but it's not showing up for some users. I've cleared cache in Craft ...
1 vote
1 answer
24 views

Is cached content served while the cache is regenerating?

I've always been unclear on this (it would be nice to include in the documentation). Let's say I use a cache tag like so: {% cache for 1 hour %} After an hour has passed, will the next user to load ...
0 votes
0 answers
74 views

Automatic Asset Cache Clear

I have a large website that various users need to upload important documents (assets) to frequently. I need to have the Craft asset cache clear every time a new asset is uploaded. The other option I'...
1 vote
1 answer
46 views

.env.sh in craft-scrips

I'm having trouble setting the variables of the env.sh file for craft-sctipts. I getting an error: File /common/defaults.sh is missing, aborting. when I try to clear the cache using a cronjob pointing ...
1 vote
1 answer
45 views

Additional code to run when cache is busted(entry added/updated, etc)

I'm using Craft Pro 3.6 in Headless mode. I've found that caching the GraphQL responses on the frontend server dramatically speeds up our load time, even with enableGraphQlCaching turned on. What I'd ...
  • 13
2 votes
1 answer
906 views

400 bad request ("Unable to verify your data submission.") when Adding product to cart

When a user tries to add something into the cart the following error appears: 400 bad request ("Unable to verify your data submission.") 2021-02-23 09:08:42 [-][-][...
  • 3,684
0 votes
0 answers
159 views

Cache not working

I'm having troubles with my site being super slow. It seems like caching isn't working. When I upload the site to a different server, everything seems fine. When I empty the template cache and load ...
  • 433
3 votes
1 answer
246 views

How to cache and serve different data to different users using Blitz?

What strategy should I take when I want to serve different data to different users with (Blitz) cache? Logged in users get one set of prices (that can vary depending on their price group memberships), ...
  • 617
0 votes
1 answer
77 views

currentUser gets cached

I'm having a problem with navigation that seems to get cached. If the page is loaded by someone who is not logged in, it shows the login button in the navigation (and it should). Once the user is ...
  • 305
1 vote
2 answers
153 views

Why is Craft loading jQuery via cpresources? And can I stop it?

I've been doing some performance checks on a website I'm building, and noticed that jQuery 3.5.1 is being loaded via cpresources: Why is it doing this? And can I stop it? I'm already loading jQuery 3....
  • 251
2 votes
1 answer
113 views

Craft CMS: Data too long for column 'cacheKey' at row 1

We have Craft CMS v3 using multi-sites. We are using cache to cache whole pages based on the absolute URL as some URLs have query parameters which seem to be ignored when not using a key. So the ...
1 vote
2 answers
192 views

Prevent caching from inside of the cache tag

Does anybody know, if it is possible to prevent caching from within the cached code/content? Something like: {% cache ... %} ... {% do notCache %} ... {% endcache %} Why? Because if there is a ...
3 votes
1 answer
582 views

How does the new caching works (3.5+)

Just upgraded to Craft 3.5+ the pages are cached (instant load on a 2nd run) but the templatecaches and similar tables are empty. How exactly does it work now? How do I flush cache for 1 specific page ...
  • 351
2 votes
1 answer
138 views

Clear cache tool missing

I'm trying to clear templates cache. The Craft CMS 3 documentation says: You can also manually clear all of your template caches from the Settings page, using the “Clear Caches” tool. When I go into ...
  • 149
0 votes
0 answers
66 views

How to stop caching entries/templates?

I have a dynamic form that creates entries in Craft 3 Pro. These entries are displayed in a "Profile Page" for each user, but it only shows the newly created entries after hitting refresh 2 ...
  • 154
0 votes
0 answers
51 views

Paginate and Cache Together and SEOmatic helpers

I am struggling to get this working correctly. If I keep the element queries outside the cache tag then this naturally stops the cache being broken and so is not a viable option. However, when I put ...
  • 1,844
1 vote
1 answer
55 views

I am getting this message when creating a new project

Cannot create cache directory /home/cmnd/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
0 votes
0 answers
240 views

Multisite with unique domains not working with Forge config

I have a live install with a primary domain of https://marketing.vessul.co/ which works great. When I've added another site to this install and it's location is another folder such as /extra-site it ...
1 vote
1 answer
85 views

How to prevent cache busting (preferably on a single section)?

I have a template that displays 1,100 entries as dots on a zoomable/searchable map. The query is cached and it performs beautifully. As expected, if I edit any of those entries the cache is busted and ...
1 vote
1 answer
157 views

How to prevent Craft from injecting scripts in the page?

I have a website that resides behind a static cache. Today, I realised that some of the cached pages contain this bit of JavaScript at the end: <script type="text/javascript"> /*<![CDATA[*/ (...
  • 132
1 vote
1 answer
327 views

Uploading Asset Doesn't Clear GraphQl Cache with VueJS/Axios

Context: I have a VueJS method that uses a form and Axios to upload an asset to an entry's asset field. The method successfully uploads the asset to the entry, and I can prove that fact via the ...
  • 367
1 vote
0 answers
25 views

How to append current version to post URL - versioning a post

I'm middle of a PWA app and one of the problems facing is versioning, once the post cached using Service Worker and if any change amended(ex: if it is an event post, the event end date may be extended....
1 vote
1 answer
112 views

Separate cache per user or user group in Blitz cache

We're using Blitz cache for a client website. Works fine. Now we need to introduce variable content for different users (based on user groups) Is it possible to have different cached versions per ...
  • 165
1 vote
1 answer
78 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', ...
  • 1,844
1 vote
1 answer
38 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 ...
  • 121
1 vote
1 answer
196 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 (...
  • 125
1 vote
1 answer
149 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?
1 vote
1 answer
62 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
1 answer
45 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
1 answer
23 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,075
1 vote
1 answer
71 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 ...
  • 1,075
1 vote
1 answer
480 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
1 answer
162 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,900
1 vote
1 answer
369 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....
  • 339
1 vote
1 answer
106 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 ...
  • 171
2 votes
1 answer
682 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' => ...
  • 249
1 vote
1 answer
120 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:...
  • 171
1 vote
1 answer
165 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.
  • 21
1 vote
2 answers
539 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
1 answer
106 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 ...
  • 125

1
2 3 4 5