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
2answers
40 views

Invalidating Paragraph Cache

I'm working on a paragraph type that will need to display on a very limited number of pages but has some specific functionality where the preprocess function will need to run each time. In my ...
1
vote
1answer
52 views

Problem setting user specific cache tags on custom block with user context

I have a simple custom block with a user cache context and a specific user specific cache tag: /** * Provides a 'User example' block. * * @Block( * id = "user_example_block", * admin_label = ...
0
votes
3answers
80 views

Database deadlock detected

On Drupal 8 we're getting a few deadlock conditions - most connected with the cache. There are quite a few answers to this issue but not so much for D8 (which has very different caching mechanism). Is ...
0
votes
1answer
35 views

What is x-speed-cache-key? What is its purpose?

Our drupal site was pentested. The pentest report labeled an action involving the header X-Speed-Cache-Key as a security concern. The finding stated: Arbitrary parameters supplied to the query ...
0
votes
1answer
49 views

Event subscriber to invalidate a cache

I am invalidating a cache tag in KernelEvents::REQUEST event: public static function getSubscribedEvents() { $events[KernelEvents::REQUEST][] = ['onRequest', 100]; return $events; } public ...
0
votes
1answer
41 views

Disable cache a custom block for anonymous user

I have a custom block, it displays in every pages with dynamic data calculates in every refresh, How can I disable cache for this block for anonymous users? I try with: public function build() { ...
5
votes
1answer
58 views

Is there a way to partially rebuild the router or invalidate a route cache?

I'm using the Groups module (http://dgo.to/group) to set up groups on a SaaS project I'm working on. I've set up a domain field on the groups, allowing groups to have vanity domain. As such, groups ...
1
vote
0answers
68 views

Invalidate cache of views block for anonymous users

I have a view display block that needs to be updated every 8 hours. I tried Views Custom Cache Tag module https://www.drupal.org/project/views_custom_cache_tag but I could not make it work. I set my ...
1
vote
1answer
72 views

Cache-Control response header includes “private”

Why does a vanilla Drupal 8 site add cache-control: must-revalidate, no-cache, private to all the pages? A Drupal 7 site adds cache-control: must-revalidate, no-cache. Is that addition of private ...
1
vote
1answer
53 views

Preventing redirects from being cached for anonymous users

I have a content type that needs to redirect only when it is tagged as "External". All of these "External" items have a field where a URL is supplied for the redirect. During initial setup of the ...
0
votes
0answers
28 views

Invalidate local_task cache for a specific entity

Is there a way to invalidate local_task cache for a specific entity? The issue is that an additional local task is defined by a different module that has a custom access check. That custom check if ...
0
votes
0answers
38 views

Region with menu block disappears suddenly, re-appears after re-saving menu

We have a website with a menu in a block, that is placed into a region "Sidebar". My customer notified me that the whole region containing the menu keeps disappearing on the live site, on average once ...
0
votes
0answers
47 views

Caching based on roles

How would it be possible to unset the "Cache-Control: must-revalidate, no-cache, private" that drupal adds for logged in users, for a specific role? I want a specific role, to follow the non-...
2
votes
1answer
59 views

Have followed instructions to disable cache for development but it's still caching

I have followed all the instructions here https://www.drupal.org/node/2598914 I'm developing a module with a block, and when I went to the Block Layout page and clicked "Place Block", the list of ...
1
vote
2answers
283 views

How can I make a response cachable by browsers?

I am working on a Drupal Controller implementation that would return a generated image as response. I used Symfony's Response and I was trying to add ETag header to it: use Drupal\Core\Controller\...
3
votes
1answer
116 views

How can I let authenticated users rebuild caches?

Is there a way for authenticated users to clear the cache without giving them the administer site permission?
0
votes
1answer
97 views

How do I disable caching for the Forum module or, alternatively, how do I fix caching?

I use the normal standard Drupal Forum module with a clean Drupal 8 installation. After I have installed it, I have a problem where "2 new posts" shows for all users. In other words, the /forum page ...
1
vote
1answer
58 views

Cache pages/variables in hook_preprocess() for anonymous user

So I am having trouble understanding the caching of variables set in hook_preproccesses for anonymous users. It seems that the entire page is cached, and not rebuilt, even when set to no caching. With ...
0
votes
0answers
35 views

Caching user profile image? [duplicate]

If I log in as User 1, i see user 1's profile picture. If I log in as User 2, I see user 2's profile picture. As expected. But after browsing a bit, User 2 would suddenly see User 1's profile picture. ...
0
votes
1answer
30 views

How to update route cache when saving an entity?

I have added a custom access check to the /user/{user} route: class RouteSubscriber extends RouteSubscriberBase { /** * {@inheritdoc} */ protected function alterRoutes(RouteCollection $...
4
votes
1answer
84 views

How to deal with Bubbleable Metadata when there's no rendering context and no render array

Since Drupal 8.0.0-beta12 "all rendering must happen in a render context", as stated by this change record. This is to avoid bubbleable metadata lost. So far, so good. Let's say I'm implementing a ...
1
vote
2answers
83 views

WSOD while sending headers, probably Cache-related

I have a very strange problem with a fresh Drupal install: On some pages, I receive a WSOD with ERR_EMPTY_RESPONSE: It happens for instance when on admin/config/development/performance I click Clear ...
-2
votes
1answer
23 views

What is the use of page_cache_fastpath ? When and how should we implement it?

When I am debugging drupal, I came across the concept page_cache_fastpath. I want to know the use of it.
1
vote
1answer
60 views

Invalidate Internal Page Cache at certain times in a day for anonymous users

Let say I have a webshop open from 9am to 11am (data coming from config). When the shop is closed, I would like to display a message (shop closed) and when the shop is open, my commerce product should ...
0
votes
0answers
23 views

when one apache server got restarted, the website session seems lost intermittently

Our drupal website is hosted in AWS cloud platform clustered with three instances in additionally, we have two memcache servers and we are using memcache_storage module for caching. We have observed ...
0
votes
0answers
20 views

Can a cached query being used as another query select?

I've got a query as follows : $selected_services = array(512, 825, 912, 913, 936); $query = db_select('users', 'u'); $query->join('users_roles', 'ur', 'ur.uid = u.uid'); $query->join('role', '...
1
vote
1answer
83 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
41 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
59 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
57 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 ...
2
votes
1answer
63 views

Remove the cache for a particular Twig file

I'm showing the name of the currently logged-in user in header, using \Drupal::currentUser()->getUsername(), but it's showing an already cached page. I know I can disable the cache for a ...
0
votes
1answer
250 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
101 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
21 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
41 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
73 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
66 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
275 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
29 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
279 views

chmod() and touch() operations not permitted [closed]

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
48 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
1answer
103 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
41 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
45 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
20 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
45 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
48 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
47 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
328 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 %} ...