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
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
58 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
268 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
112 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
0answers
23 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
51 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
29 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
73 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
79 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
21 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
56 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
19 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
81 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
33 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
47 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
56 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
58 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
165 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
61 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
70 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
46 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
167 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
27 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
191 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
43 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
75 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
31 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
42 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
19 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
43 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
46 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
46 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
237 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
39 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
235 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
84 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
41 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
33 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
167 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
57 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
75 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 ...