Questions tagged [caching]
Improving the response time, by reducing the amount of processing, in Drupal normally requires using a cache.
1,421
questions
0
votes
0
answers
53
views
How can I turn off cache on the user registration form? [closed]
In Drupal 10, the user registration form is being cached. In an incognito window, the form shows the username and password.
This is happening on an incognito page in Chrome.
This is happening using ...
1
vote
1
answer
117
views
Caching of entity UUID in a frontend form
I have a form which is displayed in the frontend, through which anonymous users can create nodes. For guest users, the pages are cached and with them apparently some part of the form. We recently ...
1
vote
1
answer
63
views
How can I rebuild the cache for a specific route when a node of type foo is updated?
I created a page by a module and the cache of that page must be deleted if a node of node-type 'foo' is updated.
How do I do that?
I read https://www.drupal.org/docs/drupal-apis/cache-api/cache-tags
...
1
vote
0
answers
82
views
Disable custom module Block Caching or force correct caching
I have build a custom module that builds out a list of child page links based on 'this' page's id.
Logged in it works as expected. But an anon user has problems which range from the block not showing ...
1
vote
0
answers
115
views
Issues using placeholdering + bigpipe with varnish and CDN for personalised block based on IP
My use case is to show a block of recommended nodes on a node page. This should be personalized by IP address, so if someone's IP address indicates they are from x location show them y block and vice ...
1
vote
0
answers
103
views
Unclear what the Redis "Render cache entries with most variations " means in the Redis report
We've recently started using Redis, and the report page shows a "Render cache entries with most variations" list. I've got about a dozen items that look like this:
entity_view:block:...
1
vote
2
answers
155
views
Why can't I disable CSS caching?
Background
I am developing a custom theme for my Drupal 10 site. I found myself constantly flushing the cache, so I have been looking up ways to disable the cache on my local dev site. My end goal is ...
0
votes
0
answers
42
views
Does disabling the Drupal cache also disable the CSS Cache? [duplicate]
I am having trouble disabling caching in Drupal 10. To be more specific, I am trying to disable the cache using the Admin interface so that I don't have to manually edit any files in case I ...
2
votes
0
answers
117
views
Need help understanding caching issue on Pantheon and Redis
On a Drupal 9.5 site on Pantehon that uses Redis, we have Drupal cache and the BigPipe module enabled.
The problem is that the cache is only being "hit" (?) if the same user visits a page ...
2
votes
0
answers
67
views
Why does Redis show the top most invalidated tags as all "config.system.menu-***" items>
Drupal 9.5 - Redis on Pantheon. We are stuggling with site performance and I see that the Most Invalidated Redis Cache Tags are all super high. This can't be normal, right?
Any ideas on how to resolve ...
-1
votes
1
answer
62
views
Using common database for multiple developers in local environment gets slow
When use the common database to develop in local environment for multiple developers in one Drupal 9 project is getting too slow. This issue occurs on Drupal sites only, others (Wordpress, Laravel, ...
0
votes
2
answers
61
views
Set cacheability on a custom route returning XML
I'm working on fixing a custom module that returns XML from a certain route. Essentially what is described in the answers of this question.
Currently this route isn't being cached. I've tried to ...
0
votes
0
answers
31
views
Parent render cache not clearing on child node update [duplicate]
I have content types Parent and Child. Parent is a referenced entity in Child. My Parent template lists all children with reference to this parent.
After updating the parents referenced in a Child ...
0
votes
1
answer
306
views
Why is the Cache-Control always "no-cache" and "X-Drupal-Dynamic-Cache" UNCACHEABLE on this site?
I have a production website for quite a long time now.
By digging, we found that the Cache-Control was always to "no-cache" and "X-Drupal-Dynamic-Cache" is UNCACHEABLE
My settings....
0
votes
1
answer
69
views
How can I prevent a specific node type from caching for anonymous users (when using hook_node_access)?
I am using hook_node_access to decide the whether a node should be visible to anonymous users based on their IP address. To prevent this being cached I am using \Drupal::service('...
1
vote
0
answers
74
views
User-specific caching, but not necessarily the current user
Background
I'm creating a render array that is built for a specific user, from data related to that user. The resulting render array is dependent on the user ID that is passed in, and it will be ...
1
vote
1
answer
94
views
How to invalidate custom block which use Cache Tags and Cache contexts for authenticated user?
I'm working on an application where authenticated user data mostly comes from an API.
Performance is significantly better since I'm using the API cache. Before, to be sure to have up-to-date ...
0
votes
2
answers
193
views
How do I disable caching of a custom token?
I have created a custom token which reads values from the Apache Request Headers. It seems to work fine for my testing, but then when another user subsequently accesses the token, it uses my values. ...
0
votes
0
answers
23
views
Views posts not displaying correctly until clearing the cache
I have an issue with a Drupal 8 website. I have some pages that have views listing some contents ( text and images). The websites uses CDN and varnish. The problem is that sometimes, the contents like ...
0
votes
1
answer
298
views
Adding cache tags to custom block
I have a custom block which load some taxonomy terms.
When I made changes to my taxonomies, the block isn't loading the new data (due to the cache). I'm passing all my taxonomy tags to my #cache ...
0
votes
1
answer
90
views
Is it possible to recreate cache tables from a more fixed source?
I am working with a dockerized Drupal environment in which we want to track content alongside our theme, modules, etc in source control. We achieve content tracking by using mysqldump to dump the ...
1
vote
1
answer
43
views
Cache two sets of nodes [closed]
I have a website where I have some blocks that have one content on all nodes, but different content on nodes with certain NID.
Right now, I have condition in block template based on node ID and blocks ...
0
votes
0
answers
59
views
How to modify the "href" attribute of some of the links of an html field type?
I'm using drupal 9.4.8 and I have a content type called "articles" which has a "body" field (which is a reference to a paragraph) and I'm making an algorithm to check all the ...
1
vote
1
answer
61
views
Are media entity Ajax calls cached?
In my Drupal 9 site with CKEditor 4 and I have created "media gallery" media type, which displays set of images (using slideshow module). So, when I click "insert media" CKEditor ...
2
votes
1
answer
199
views
How can I test Max-age on cache?
I have a Controller using cache tags. I have just been asked a change that requires a Max-age also (show next event starting from current time); I explained that the only way to have this is with some ...
2
votes
1
answer
675
views
How to programmatically invalidate the cache of every node
I have a form submit function that is meant to invalidate the cache of every node if a specific field is altered. Here's how I'm attempting it.
$config = $this->configFactory
->getEditable('...
0
votes
0
answers
94
views
How can I Speed up Cache calls?
I have a site with a few complicated forms. They require a lot of CPU time to calculate, so I am caching the $form array in order to be able to deliver the form quickly to the user. To do this, I am ...
2
votes
1
answer
140
views
How can you cache a form render array?
I have a custom module which builds a set of complicated forms, and these forms are built dynamically (the option lists for certain SELECT items, for example, are fetched via an API call). Some of ...
0
votes
1
answer
131
views
How can I bust the cache for the toolbar?
I am creating a drupal module and here in the module file i created a check on hook_toolbar() function that if there are credentials in the database it will show 4 links in dropdown otherwise it will ...
1
vote
1
answer
104
views
Service continues to act as shared when shared is set to false
According to Symfony docs, doing shared: false on a service should mean that each time you call a service, you get a new instance. However, this doesn't seem to work for me. I am using Drupal 9 which ...
0
votes
1
answer
95
views
Excluding individual page components from caching
I can't seem to find a straight answer online about whether it is possible to exclude just one component of a page from being cached.
My component appears on all pages of the site and comes from a ...
1
vote
0
answers
69
views
How to invalidate config or service cache
I have a service wich is loading a config at construct time:
class MyService {
public function __construct(ConfigFactoryInterface $config_factory) {
$config = $config_factory->get('my.config')...
2
votes
1
answer
578
views
What cache service should I use?
I just used a cache service explicitely for the first time, in a function that calls a remote service. The result is a simple string that may change day by day, but it's very rare that it changes for ...
0
votes
1
answer
77
views
What is the difference between Platform CDN and Cloudflare? [closed]
The cloud provider I use(Acquia) has a set of API endpoints, and one of them is to clear caches, including Platform CDN + Varnish.
When I read Platform CDN, it gets me wonder where Cloudflare then ...
1
vote
0
answers
122
views
Why does placing a menu block on a page stop the page from being cached for anonymous users?
If I show a menu block on a page, that page will never be cached for anonymous users. Is that expected behaviour or is it caused by something else on our site? If it is caused by something else, ...
2
votes
0
answers
42
views
Changes in email template are saved, but not used (cache?)
I'm usually trying to find an answer/clue on my own, and usually it works, but at this time search is fruitless.
So I'm trying to edit a welcome email text, using /admin/config/people/accounts section....
3
votes
1
answer
537
views
How do I properly cache a menu item that varies by user?
We are attempting to show a users first name on a profile menu for authenticated users. We added a lazy builder to the hook_preprocess_page hook in our theme given this is highly dynamic content on ...
0
votes
2
answers
1k
views
How can I fix the "Predis\Client not found" error?
I have a project based on Drupal 7. I installed PHP 7.4, Redis, and php-redis on Ubuntu. I get a Class 'Predis\Client' not found error.
The values in the setting.php file for the module are the ...
1
vote
0
answers
192
views
Need help with Cache::invalidateTags() and cacheable metadata in REST route
I have a REST route that returns some JSON. I am trying to get cache tags working correct, but it doesn't seem to be working. Only updates if I flush all cache.
I have a queue that runs on cron every ...
0
votes
0
answers
81
views
Block cache for anonymous users depending on previous behavior
I have a content type named "Campaign". Each Campaign has a totally different look and feel in the website.
Once a visitor wants to join a campaign, the user is redirected to the normal ...
2
votes
1
answer
192
views
Which PHP parameter do I need to tweak in order to fix the PHP APCU CACHING site status warning?
I get a memory warning in my Drupal site, but I still have sufficient free memory on the server.
Which parameter do I need to tweak in order to fix this warning?
-3
votes
1
answer
258
views
What is the relationship between internal page cache and dynamic page cache?
I faced a problem in my browser. Firstly, I removed an internal cached page that could be accessed by anonymous authenticated users. The page was still cached from the dynamic page cache.
I accessed ...
0
votes
0
answers
458
views
"LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected."
Hi I've created a module with a controller but now i'm getting this message;
The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you ...
0
votes
1
answer
148
views
Toggle (show or hide) visibility of content type field in view depending on relationship with other content type
I have a member content type that displays info about a company's member. One of the fields is named member publications, and it's a link to a blog view where the publications of the member (another ...
0
votes
1
answer
126
views
Request does not reach controller after a few requests
I have a custom module for an online shop. Module's controller gets a product id which is sent by the user through a query string and puts it into the session. That is crucial for the shopping cart ...
0
votes
1
answer
125
views
Image inside paragraph being cached
I have a Paragraph type called image - that holds a media reference and also a field which describes how the sibling image should be rendered. I look at the value of the "field_image_style"...
0
votes
1
answer
108
views
Proactively rebuild view cache
I have a view that takes a while to build when the cache is cold (around 11s). When the cache is hot, the view loads quickly, of course (around 100ms). I'm using tag-based caching for this view, so ...
0
votes
1
answer
140
views
Debugging anonymous session regarding cookie specific page caching
Have been following this guide to make caching depend on the value of a specific cookie:
https://cornel.co/article/page-cache-cookiesor-anything-available-http-request-d9
However, it does not seem to ...
2
votes
2
answers
420
views
Node ID caching on hook_form_alter()
I have a webform with an email field. I am embedding the webform on each node, with a field on the node for the email address.
I implemented hook_form_alter() in my .theme file that loads the node ...
2
votes
2
answers
254
views
Is there a way to not include the {{ content }} variable in a node template and still have the node cache clear when the node is updated?
We have nodes that have dozens of fields and have elected to not include the {{ content }} variable as it is tedious and looks messy having something like the following just to not print the fields. ...