Questions tagged [caching]

Improving the response time, by reducing the amount of processing, in Drupal normally requires using a cache.

Filter by
Sorted by
Tagged with
1
vote
2answers
345 views

Block cache depending on current node and its last modification time

I am building a module with a block that outputs some informations from the current node. When i return my render array i managed to get the cache as "node dependent" using (maybe not the best method ...
0
votes
1answer
435 views

Request referer gets cached

I need to grab referer and save it for the first time (I save it to sessions) and when the user gets to a specific page forward it. My problem is that after opening page with the same referer few ...
0
votes
1answer
391 views

Nginx with boost serves cached pages to logged in users

I run my d7 using boost under nginx. Previously i had apache server so the .htaccess generated by boost module has the rewrite_mod for logged in users in order not to hit cached pages. What is the ...
1
vote
2answers
3k views

Disable caching on a route

I have a route with a parameter, e.g. /r/{app_id}. The controller extends ContainerInjectionInterface. The method either returns a render array or a new TrustedRedirectResponse. I believe I have a ...
3
votes
3answers
2k views

How can I turn off caching redirect?

I have a url that would normally redirect to a specific page, however, some code is run prior to this. I am returning a RedirectResponse instance, and it appears to be being cached. How can I force ...
0
votes
1answer
380 views

Boost not caching subdomains

I have a website with subdomains set up, the naked domain without any subdomain gets cached by boost and there is the message by boost in the footer. But any subdomain does not get cached. We are ...
1
vote
1answer
37 views

Set parameter for internal or external traffic based on IP

We want to block external traffic in Google Tag Manager and I am trying to do something like shown here. I created this: /** * Implements hook_init(). */ function myfunction_init() { $...
0
votes
1answer
28 views

How to un-cache a specific node field (also for anonymous)

My goal is to replace (by a custom markup) the render array of field_product when some conditions are met. (in a ecommerce site) Ex: If this is the weekend or if it is after 12pm the field_product ...
-1
votes
1answer
981 views

Session not refreshing until the cache is cleared

I am trying to store data entered in the drupal custom form in order to display it in next page using session. For the first time it is running perfectly, but for the second time it contains the ...
1
vote
2answers
538 views

Run cron on a different web server?

Is it possible to stop the cron on the main web server and run it on another web server that is using the same codebase, same MySQL server and same Memcache sever? The cron web server will run import ...
2
votes
2answers
619 views

hook_node_insert() sporadically not being fired after node_save()

I have a situation where, every once in a while, I'll save a new node, and hook_node_insert() appears not to be called--AT ALL, for any of the modules that implement it. For example, if I look through ...
0
votes
0answers
202 views

Cache REST Response

Is it possible to cache the rest response other than CORS? Or is it possible to cache the response using memcache? Or is there a method available on rest for the caching? Update to include a sample ...
0
votes
1answer
503 views

Commerce add to cart not adding product to cart

I have an e-commerce site. In that, I have created product listing page using views. I have added add to cart field in the view, so the every product in the view will have add to cart button. I have ...
7
votes
5answers
14k views

How to correct disappearing admin menu?

I use the Admin Menu module for my projects. In my Drupal 7 and Pressflow 7 instances, it randomly shows only some menu items. At first, I thought I could correct this by clearing menu cache. When I ...
1
vote
1answer
793 views

Menu theme suggestion ignored when cache turned on

I have an alternative main menu that is used on specific node types. When turning on the cache the menu block is cached. The theme suggestion for the menu is then ignored. I tried to disable the menu ...
0
votes
2answers
35 views

CSS changes not updating

Basic caching settings all off: settings.local.php is loaded: Bottom of settings.php: if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) { include $app_root . '/' . $...
0
votes
2answers
54 views

After save empty cache of referenced node

I have two content types. For clearer question I will work with the content types event and location. From my location content type I can reference to and event. Then on the event page I show the ...
1
vote
3answers
1k views

Disable caching on a custom plugin block

I read a lot of posts on how to disable caching on a custom block but none seemed to give the perfect solution. $build['#cache'] = ['max-age' => 0] or public function getCacheMaxAge() { return 0; }...
1
vote
1answer
501 views

Alter view with hook_views_post_render and save results to cache

How can I alter the results of a view with hook_views_post_render but save the altered output to cache, in order to avoid the overhead of altering the results on every request? The ideal scanario ...
3
votes
2answers
380 views

Invalidate Internal Page Cache on cookie change

I need to invalidate the Internal Page Cache for anonymous users when the value of a specific cookie changes. How can I implement this? I'm tried to add: $build['#cache']['contexts'][] = 'cookies:my-...
0
votes
1answer
434 views

Boost + Domain Access + flushing cache

I have the Boost and Domain Access modules working correctly. But I've found that if the cache is flushed for one domain it doesn't clear for the others. So if content is added to one, it won't show ...
2
votes
2answers
569 views

Add cache context to altered links

I am using hook_link_alter(&$variables) to alter links depending on the user's role. I'm doing this for links in the main menu as well as for custom links shown on entities. This works good except ...
0
votes
1answer
640 views

$.cookie is not a function from form.js with block cache

I am getting this error if I turn my block caches on. I have traced back the origin back to Drupal core form.js but can't seem to see what's going on here. Any ideas? Here is the debug: form.js?v=7....
0
votes
2answers
514 views

How to disable CACHE in VIEW PAGE display

DRUPAL 8 I am using VIEW module to create a page which loads data from a database table. Seems this view page is caching because whenever I add a new record in this table via custom input form, it ...
1
vote
1answer
534 views

Cache sometimes is not being updated on saving operations

This is a problem I'm struggling with for a few months already. I'm maintaining a pretty big news website, with a lot of content and multiple editors. The website is using paragraphs (which I don't ...
0
votes
0answers
12 views

Redis server hang up when I update drupal

I´m not sure if this is the right place to put this question. I hope it be. I have an apache server with Redis and several Drupal 7 websites that uses Redis as cache backend. It works very good and ...
1
vote
1answer
45 views

Remove the cache for a particular Twig file

I'm showing currently logged in username in header. But it's showing already cached page. I know, I can disable cache for particular page in module using \Drupal::service('page_cache_kill_switch')-&...
14
votes
4answers
16k views

How do I disable Twig and block cache for a specific module?

I'm working on a module in Drupal 8 which retrieves time sensitive data from an external REST api. The data is processed and forwarded to a Block. The final data is sent to a Twig template like so: .....
1
vote
1answer
632 views

Why am I getting a 200 status header when the page is being served from cache?

Been running into a weird issue with all of our Drupal 8 websites, hosted on different servers. The pages are caching correctly, x-drupal-cache header shows a HIT as well. The page however has it's ...
2
votes
4answers
7k views

ReferenceError: Drupal is not defined

I am working on a production site, moving settings from a development site for a mobile environment. However, I am receiving the above error. I can not figure out what is causing this error. It does ...
0
votes
1answer
106 views

Drupal 8.7.0 chmod() and touch() operations not permitted

After updating drupal8 for 8.7.0 and then to 8.7.1 versions i have next errors: Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line ...
4
votes
2answers
2k views

Passing current node ID to the block template

I have a module with a custom block MyCustomBlock.php that get the nid of the current page and pass the value to the block template: $node = \Drupal::routeMatch()->getParameter('node'); $nid = $...
0
votes
1answer
111 views

Cache SOAP search results from external web service

I've inherited an older Drupal 6 site which calls an external SOAP web service which not only takes a while to query and display results (approx. 5 seconds) but also re-queries the web service when ...
3
votes
3answers
367 views

How do I cache an object loaded through SOAP from a third party that I use in forms?

I am loading and object that I use to populate a form. Then on form submit I return some of the fields through SOAP back to the third party. On submit the form building function gets called and loads ...
0
votes
2answers
81 views

How to prevent dynamic library definition from being cached?

I have a use case where i want to dynamic add library , Attributes of library will vary with page. In my case the $callback will be different depending on the page. $libraries['sample.my-lib'] = [ ...
0
votes
1answer
221 views

drupal loses track of a library (leaflet), randomly

I have an strange problem with a library (leaflet). I have some maps, and it works fine, but randomly (as far as I have been able to detect) drupal is unable to find leaflet.js and leaflet.css (it ...
0
votes
1answer
487 views

Cache is not cleared

I have a weird problem that the cache won't be cleared. It all began since I added a template file "field--custom-field-name.tpl.php". The field is attached on user entity type. I put var_dump(...
1
vote
2answers
633 views

How to display the output of my module without clearing cache and refresh page?

I created a very simple module which generates a tag cloud based on user input; you can see the code here. // wow.module function wow_menu() { $items = array(); $items['wall/of/words'] = ...
13
votes
5answers
15k views

How can I prevent a particular page being cached?

I have activated the cache on my Drupal 8 site, and of course all pages are cached as expected. However, I'd like to have a specific page bypass that cache. In my controller I built the page as ...
2
votes
1answer
584 views

CSS still requiring clearing cache after following steps to switch caching off

I have followed the steps detailed in this tutorial and many others -> https://knackforge.com/blog/rajamohamed/disable-drupal-8-cache-during-development I have copied and renamed the sites/example....
0
votes
1answer
581 views

The directory public://xmlsitemap was not found or is not writable by the server

I have just installed XML Sitemap on a EC2 drupal 8 instance. I am seeing the following error message in the admin report status page: XML sitemap cache directory Not found or not writable The ...
0
votes
1answer
47 views

How can I purge a specific URL from varnish cache without making a curl request?

I'm programmatically updating images and keeping the same file name. I flush the image styles for the image when I do this, but I'm running into an issue where my image styles aren't being regenerated ...
0
votes
1answer
24 views

How do I enable the ETag header?

I'd like my JSON:API responses to return the e-tag header so that consuming remote sites can determine (e.g. with a HEAD request) if they need to ditch their cached responses and re-fetch. There is ...
0
votes
0answers
20 views

How to move js in header from footer in D8 [duplicate]

I am using twitter bootstrap theme in drupal 8. By default bootstrap.js and jquery.js loaded in footer. I want to override the order of these js and place in header. Please let me know if its ...
1
vote
1answer
396 views

How to add image cache headers?

When doing SEO tests, we consistently seeing a message for cache headers on images. We were thinking of implementing but cannot find the appropriate way to test this as the x-cache still gives a MISS. ...
0
votes
1answer
605 views

Fatal error: Call to undefined function wincache_ucache_get()

After downloading fresh files and restoring fresh database from prod website, on my local server (IIS) I have a problem. Fatal error: Call to undefined function wincache_ucache_get() in E:\XXX\...
0
votes
0answers
39 views

Caching input filter results

I'm creating an input filter that is quite expensive, as it makes a call to a remote service as part of the processing of the output. In Drupal 7, I'm pretty sure that the filtered output of an input ...
1
vote
1answer
551 views

Cache not clearing on expiry

Using the steps explained here: http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7 I'm storing an array with specified expiry time. But what is happening is that even after ...
2
votes
1answer
61 views

Why doesn't LinkFormatter::viewElements bubble cache metadata?

I am trying to understand how the token system in Drupal 8 interacts with the cache bubbling system and in LinkFormatter I see $link_title = \Drupal::token()->replace($item->title, [$entity->...
2
votes
1answer
532 views

ssl with boost and securepages module

I have this doubt. I have a website in drupal 7 currently live (Kickstart2) and use as cache management boost I have to buy a ssl certificate on my domain and with this certificate I would like to ...