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
0
votes
0answers
7 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
26 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 ...
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 ...
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')-&...
-2
votes
0answers
29 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
46 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 ...
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 ...
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->...
1
vote
1answer
38 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 ...
0
votes
0answers
59 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
0answers
25 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
1answer
100 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 ...
0
votes
1answer
37 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 ...
1
vote
0answers
42 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 ...
0
votes
1answer
12 views

How to store your own key-value pairs in Redis using PhpRedis with D7 Redis module

We have the D7 Redis module installed, which is being used as the cache mechanism for D7 caching. That module uses PhpRedis as the underlying library. I would like to use that same Redis instance to ...
0
votes
1answer
37 views

Referenced entities show old value when changing properties

I have three custom entities, all generated with Drupal Console. I only added some basicFieldDefinitions to them before testing some CRUD operations on them. I have these entities: ConfigEntity (...
0
votes
1answer
17 views

Configuration settings of Authcache for roles

I'm not sure about configuration of roles in Autchcache module, specifically with authenticated user role. I want to enable caching for both anonymous and authenticated users, but I want to exclude ...
1
vote
0answers
40 views

Caching of sub site menus

Preamble We currently have a Drupal 8 site that has subsites (accessed via subdomains). On the main site (non-subdomain) we have a main navigation menu defined (this is presenting correctly on the ...
0
votes
1answer
43 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 ...
0
votes
1answer
44 views

How do I disable the cache?

I have created the settings.local.php file inside the default folder and uncommented the the following lines. $settings['cache']['bins']['page'] = 'cache.backend.null'; $settings['cache']['bins']['...
3
votes
1answer
149 views

How to condition output based on a URL query string

In my node preprocess function I check the value of a query param... $variables['exclude_urls'] = \Drupal::request()->get('exclude_urls'); And in my template, I have... {% if not exclude_urls %} ...
0
votes
0answers
32 views

Efficient way to get entity information

Which is an efficient way to fetch entity label and id? Database query or entity query with entity load? I need to get the list of all taxonomy terms in an associative array of ID and Label. I can ...
0
votes
0answers
32 views

How to delete the cache files when the file cache module is installed

You have a site with the filecache module that saves the cache in files instead of the database. The filecache directory to date has a size of 30 Gigabytes. You want to disable the module filecache ...
0
votes
1answer
148 views

Disable Internal Page Cache and enable Internal Dynamic Page Cache with cloudflare CDN

Drupal 8.6.13 hosted on inmotion hosting VPS 2000 Website visitors/users are coming only from one country (Turkey) which is far away from the server location of inmotion hosting (USA). In below ...
3
votes
0answers
74 views

What does it mean if expire is set to null in a cache table?

I am looking at the documentation for the expire field in the cache tables and the documentation in CacheBackendInterface.php says: * @param int $expire * One of the following values: * - ...
2
votes
1answer
31 views

How do I clear a specific cache entry?

I saved a cache entry using cache_set(). How can I clear this entry using Drush?
0
votes
0answers
30 views

Preventing REST results from being cached [duplicate]

I have extended Drupal 8's REST services to provide any registered user a certain part of their own data. Let's say my endpoint is: /my_api/get_current_user_data?_format=json However, it looks like ...
1
vote
0answers
36 views

How do I cache web page for different header parameters?

I use AWS cloudfront with my drupal site. It sends below value with response headers. CloudFront-Is-Mobile-Viewer => true This value is true when you view your site with a mobile. And if this is ...
0
votes
0answers
25 views

Auto cron runs but doesn't clear the cache

behind the scenes i am accessing a service if (cache) stuff = cached.data else stuff = service.data auto cron is running; however, i notice the auto cron is not purging the cache. I have to go into ...
0
votes
2answers
125 views

Dynamically remove library based on user role, cache context not working

I want to remove all libraries of modules & themes, except those from modules/themes that are defined by me. This should only be done for anonymous users. All libraries should be served to ...
-3
votes
1answer
56 views

How do I clear the cache for a custom block?

I have custom block holiday this block is not updating once I'm updating data in database when I'm clearing the cache block is working. Is there any solution for this cache issue? I'm attaching the ...
0
votes
0answers
19 views

Advanced Meta Tags and Image Uploading

A little background: We have a Drupal 7 site with hundreds of thousands of nodes, each month we create between 5-8,000 new nodes that are essentially products we sell. These nodes are 80% clones of ...
0
votes
2answers
71 views

Page cache works on local dev but not on production

I've a Drupal 8.6.9 site running on Apache 2.4 and PHP 7.2. I've enabled the internal page cache, the dynamic page cache, and the BigPipe module in an effort to tease out some more performance. I've ...
-1
votes
1answer
43 views

Is there a way to disable cache only for a single template file?

For my view I need to update my fields dynamically, for this reason I need to disable cache for views-view-field.html.twig, as it takes the parameter from a contextual filter. I send an argument from ...
0
votes
0answers
54 views

How do cached discovery definitions affect entity caching?

I'm experiencing an interesting and odd situation with entity (field value) caching. I'm using hook_ENTITY_TYPE_storage_load() to set the value of a field when nodes of a certain type are loaded. Per ...
3
votes
1answer
140 views

How do I avoid caching a redirect response from a form?

I have a Drupal 8 form used by authenticated users which sometimes needs to redirect based on the presence of absence of something in session. I don't want the redirect to be cached. My form is ...
3
votes
0answers
106 views

Warming up dynamic page cache for authenticated users

We're currently working on a rather complex Drupal 8 based website. After clearing caches, the majority of pages/routes require about 30-60 seconds for being rendered/returning the desired results. ...
1
vote
1answer
71 views

How to make use of the render placeholder system for cacheablejsonresponse?

I have custom controllers which provide CacheableJsonResponse responses. Those responses are quite heavy to build (couple of seconds), so I want to build them better. I build those responses by ...
0
votes
0answers
17 views

How to provide an uncached version of a view for preview purpose

A drupal 7 commerce shop has product pages which are made by a taxonomy view displaying commerce products; each of these products themselves consist of a view, so on the bottom line it's a nested view....
1
vote
1answer
152 views

drupalSettings cached in page

I have a module that adds functionality to the front-end. The feature can be turned on or off via the configuration page of the module. I pass the settings to the frontend in the HTML preprocess ...
0
votes
0answers
42 views

How can I find out which cache is still active?

I have been walking through this page https://www.drupal.org/node/2598914 but I still have to hit clear cache during development process. vendor/bin/drupal site:mode dev PHP Warning: Module '...
1
vote
0answers
63 views

PHP Type Error with Cached Plugin definitions in DiscoveryCachedTrait.php

We have the following set up for Drupal 8.6.3 - IIS Server, MSSQL Server, sqlsrv drivers. However, every few hours, Drupal throws PHP errors(all of them belonging to the same kind) and most pages from ...
0
votes
0answers
81 views

Is there a setting to turn off block caching per block / block type in the admin UI?

I want to display the date in a block and make sure that it is always up-to-date (i.e. not storing an old cached value). Currently the date does not change, unless the cache is cleared ( via admin/...
1
vote
1answer
116 views

Adding a cache tag to an entity view display doesn't do anything?

I wrote a module that implements hook_entity_view_display_alter(). I modify the display settings of one of the fields depending on some configuration setting of my module. /** * Implements ...
0
votes
2answers
87 views

Solr search views cache issue

I have views for solr search result and I have highlight processor enabled. There seems to be cache issue effecting search result. Search results are rendered array of entities. For example: If I ...
0
votes
1answer
105 views

Custom block and menu caching

I have a custom block building a menu. The cache works fine until a menu item is enabled/disabled in the menu edit, e.g. admin/structure/menu/manage/main toggle the enabled checkbox and save. The ...