Questions tagged [caching]

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

0
votes
1answer
31 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 ...
0
votes
2answers
501 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
513 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
42 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
615 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
75 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
110 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
73 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 ...
-2
votes
0answers
28 views

Selection, storing, caching of custom fonts

I would like you something about font paths and font caching in Drupal 8 (8.7.2). My aim is to use a custom font, without using the @font-your-face-module. Just for trying out, on my local ...
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'] = ...
12
votes
5answers
14k 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 ...
-5
votes
0answers
34 views

Suggestion - Caching based on user

In my application a part of the header changes based on user to user. I have created a REST API service to collect the JSON data that builds the header based on that. I just want a suggestion whether ...
2
votes
1answer
564 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
569 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
36 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
20 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
376 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
592 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
546 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
60 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 ...
0
votes
2answers
965 views

Fatal error: Maximum execution time of 240 seconds exceeded in sites/all/modules/memcache/memcache.inc on line 353

I am using multidomain site . After adding a new domain record, I was asked as follows: Content access permission needs to be rebuilt on this page. When I clicked on Rebuild Permissions button, the ...
13
votes
5answers
12k views

Cache Form table size is enormous

Cache table's size had increased to 10+ GB last month, and I had fixed it temporarily by truncating it. Last time I checked it was around 1GB. So in couple of months it will hit 10GB again. How should ...
2
votes
2answers
2k views

How can I turn off Drupal redirect caching?

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 and it appears to be being cached. How can I force this to not ...
1
vote
1answer
36 views

Wrong User Image Display - Weird Twig Cache?

I'm having a weird issue with incorrect user images being displayed and it seems to be a caching issue or perhaps I am passing the user image incorrectly to my template. Problem: If I login to a ...
6
votes
1answer
2k views

Cache controller with json response

I want cached a controller that returns a json.. I try this: $build = array( '#cache' => array( 'contexts' => ['ip'], ), ); return (new CacheableJsonResponse(['test'], 200))->...
0
votes
0answers
51 views

redis vs memcached vs varnish

As a contractor one jumps between different installations of drupal for different clients. Often the architecture is baked in and needs to be maintained. My experience tells me caching solution used ...
0
votes
2answers
615 views

Cache pages for anonymous users stuck on

I can't turn off the "Cache pages for anonymous users " cache option. I uncheck it and then hit save as usual but it stays on. Is there some sort of module conflict causing this or possibly an issue ...
1
vote
1answer
852 views

How to access an entity loaded out of the cache

I am working on a Drupal 8 modules which should push a http response header based on a value stored in an entity or a list of entities. The module was originally done for D7 and now is in porting up ...
0
votes
1answer
677 views

How to setup Recaptcha on pages cached by Varnish?

On a site where a contact form is displayed at the bottom of each page, I implemented Varnish caching. To do so I had to deactivate Recaptcha to avoid 'no cache -must revalidate " headers. I tried ...
0
votes
0answers
23 views

Check for cookie value(s) for a visitor and attempt to authenticate them?

I have a case where when a visitor comes to the site from a subsite (different application), if they are authenticated (there will be a cookie value), I need to get this cookie value and initiate a ...
0
votes
2answers
764 views

Clearing cache breaks site

I'm trying to load a production site in a dev environment using the site's codebase (core 8.3.7, contrib and custom modules and vendor folder) and the current database. After struggling a bit with it,...
1
vote
1answer
847 views

How to check if result from cache_get() is expired?

cache_get always returns an object and I'm a bit confused by its values. There's probably a short generic function that can handle this for once and for all. $cache = cache_get('key'); if ($cache) { ...
0
votes
1answer
35 views

Are there specific cache tags which get reset on user login?

Scenario I'd like to invalidate a set of caches based on user id upon user login. I'd like to avoid creating new tags, and limit new code as much as possible. Presumably the way to do this is with ...
3
votes
1answer
8k views

Can't get Varnish working properly, not caching anything. (varnishd is running , status is tick)

System info: Ubuntu / LAMP Drupal 7.14 Varnish 3.0.2 Varnish module: 7.x-1.0-beta1 http port 80 I have installed Varnish in server. I started it as: $ sudo varnishd -f default.vcl -s malloc,1G -...
5
votes
1answer
3k views

Clear only CSS/JavaScript cache when files are aggregated

When aggregating CSS/JavaScript files using performance page in Drupal 8, drush cc css-js doesn't work, and I've to clear/rebuild all cache. Is this a bug or the normal behavior? How do I properly ...
0
votes
2answers
498 views

Disable block caching

I just made a simlple block by using block > custom block, so I didn't make it programmatically. I am a Drupal 8 newbie, and I look for a simple and clear solution how to disable caching for that ...
1
vote
0answers
34 views

hook_js_alter is getting cached

I recently come across a issue where my page was rendering two boostrap.js (Offcourse bad coding). An external Js from a module and another js from twitter bootstrap theme. Its causing some of the ...
21
votes
7answers
55k views

How do I clear cache using an SQL query?

After a module update, my site has become unusable, and only shows a php error message. I tried circumventing the problem with drush cc, but that didn't help. Also tried with a custom php script but ...
0
votes
1answer
42 views

Editing contents of custom block referenced in paragraph type, doesn't reflect changes in node where displayed

So, I have a Custom Block type, let's call it Sidebar Links Block. In an Article, we have a Sidebar paragraph type that allows quite a few different entities, one of which is the Article Sidebar Links ...
12
votes
5answers
6k views

Which tables should be emptied when clearing database-stored cache manually?

Prior to D8 to clear cache manually one could truncate all tables beginning with cache_. In Drupal 8 there are still tables starting with cache_, but there's also a cachetags table. Is the advice in ...