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
3
votes
1answer
634 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
203 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
148 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 ...
1
vote
1answer
946 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
50 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
147 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
273 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
254 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
295 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
1k 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 ...
0
votes
1answer
126 views

Capturing cache metadata from file_create_url?

I'm writing a Drupal 8 controller which takes in a media entity, and returns a redirect response to the actual file URL. It works by finding the file associated with the media entity, and then does ...
1
vote
1answer
184 views

Cache max-age doesn't correctly expire at midnight

I've got a node which cache should expire every day at midnight. Additionally I've a block showing the same node in another display mode, that also should expire every day at midnight. I thought this ...
3
votes
2answers
984 views

Dynamic local tasks - caching problems

I try to create some local second level tasks depending on some settings for a custom entity. But unfortunately sometimes these local tasks do not appear - they appear again when rebuilding caching ...
0
votes
1answer
73 views

After calling drupal_flush_all_caches, menu items with access callback TRUE are giving access denied error

I was building a custom module that affected the front page and I found myself having to go clear the caches for it to take effect. So as part of the code, I put in drupal_flush_all_caches(). After I ...
0
votes
1answer
141 views

Is it necessary to clear site caches after putting site into maintenance mode?

I enabled maintenance mode on a Drupal 7 site; however, when I checked the homepage as an anonymous user, I noticed that the original homepage was still being displayed rather than the maintenance ...
0
votes
1answer
2k views

How can I automate the “Clear Cache” everyday?

Currently we have to clear it manually everyday logging in to admin console and browsing to Home->Administration->Configuration->Development->Performance Is there way we can automate this job in ...
1
vote
1answer
1k views

Disable caching of attached css/js libraries for custom module?

I have been trying to disable caching during development so I followed drupals guide step by step: https://www.drupal.org/node/2598914 After doing this I would assume that the caching is completely ...
1
vote
0answers
83 views

Caching and Mysql binary logs [closed]

In my recent Drupal 8 project, we have the master-slave setup and we face binary-log files getting generated to a huge amount for every hour. On decoding these binary log files we figured out a lot of ...
0
votes
1answer
39 views

Media and cache keys

I'm using images inside of a Paragraph, and trying to use checkboxes in the Paragraph to control whether to display the credit and/or caption of the images. The problem is that the image gets cached ...
0
votes
2answers
144 views

Trigger a drush @sites cr --yes daily [closed]

Drupal 8. Title sums up pretty much my question. I'm wondering what is the best way to rebuild all my site's cache daily. A cron job with Truncate table cache ? Module who rebuild cache on each ...
1
vote
1answer
2k 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
903 views

Style Sheet sometimes does not load Microsoft Edge Browser [closed]

I am using the Advanced CSS/JS Aggregation module to load css once the page has loaded: <link type="text/css" rel="stylesheet" href="/sites/default/files/advagg_css/...
0
votes
2answers
144 views

Can't acces my site and without login and drush clear cache

I moved my local site to shared host. all code has been deployed to the staging server I changed settings.php import the database from local to the staging server database When I try to reach the ...
0
votes
1answer
55 views

cache_form has been truncated. Permanent error MYSQL Incorrect key file when a form is accessed

On a site I inherited, I can see cache_form is empty. It has been truncated some time ago. I have got an error crashing my site when accessing many type of forms: views exposed forms, forms to edit ...
0
votes
1answer
45 views

Memcache interfering with Simpletest

Adding some tests to an older Drupal 7 site and a few of the tests check for the presence or lack thereof of custom cache items. Having this in settings.php seems to interfere with Simpletest using ...
0
votes
1answer
316 views

Reassign $view_mode using entity field passed to hook_entity_view_mode_alter()

I'm using baseFieldDefinitions to create my custom entity form. With gracious help here, I've been able to successfully generate a radio button on the form which lets the user select what view mode to ...
0
votes
1answer
1k views

How work BigPipe cache around block views?

I have 2 blocks with swiper.js around. This 2 blocks are from the views module. I need to print them in the theme like i want so, i load them into the preprocess_page. $block1 = \Drupal\block\...
4
votes
2answers
922 views

Cache tags for all entities of a certain type

I understand how you can add cache tags to a custom query for a particular entity id (or list of them) but is there a way to add cache tags that will invalidate a query if any entity of type FOO is ...
2
votes
1answer
102 views

How to implement per user caching when restricting display of comments by author

I have threaded comments on a site where there are two roles, reviewers and administrators. Comments are shown in a view block added to the node (in this case a webform). The view format is set to '...
4
votes
5answers
8k views

How do I clear the cache for a single node?

In my module, I can call cache_clear_all() (D7) or drupal_flush_all_caches() (D8), and this would clear the cache for all the nodes. Is there a way to clear the cache for a single node? What I need ...
0
votes
1answer
59 views

D7 - does drush rr ALSO clear cache?

Someone just told me that in D7, drush rr and drush cc all do the same thing. I can’t find anything that explicitly states the difference, nor can I find anything that supports such a claim. ...
2
votes
1answer
6k views

How to correctly use cookies? (Twig and cache context)

In my current project I need to alter node templates depending on previously visited landing page. My idea is that, when a visitor visits one of these landing pages, a cookie will be set, and ...
0
votes
0answers
62 views

How to get the language from the cache?

I am working on the drupal 8 website, which is presented in 3 different languages. The issue for me is that when the user switches the language on the panel, some parts of the website (block in the ...
0
votes
1answer
816 views

Permissions/access caching per node and per user [closed]

UPDATE: Narrowing this a bit. I need to, for either (a) all nodes of a given type or (b) all nodes on a specified list of node id's or (c) all users on a list of iser id's, clear the cached ...
0
votes
0answers
332 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
0answers
65 views

Theme function ignored until cache flushed multiple times

I'm using the ShareThis module to power my sharing links on a Drupal 7 site, but I don't think my question is specific to this module. I want to modify the link that's shared and sharethis provides a ...
0
votes
1answer
271 views

Clear all “pages” cache [closed]

Is there a way on Drupal 8 to clear all "pages" cache or all "nodes" pages? I was thinking about a custom drush command but I don't understand how to do this.
0
votes
1answer
60 views

How do I clear the order cache?

I manually update an order using the following code. db_update('uc_orders') // Table name no longer needs {} ->fields(array( 'order_status' => 'payment_received', )) ->condition('...
3
votes
2answers
589 views

Which cache bin to clear after changing services

I made some changes to own services and now I get an error about invalid arguments. When I clear all caches everything works fine. I don't want to clear all caches in my production environment. Which ...
1
vote
1answer
2k views

Invalidate a specific cache tag on any saved taxonomy term

I would like to clear cache tag of a particular bundle when any taxonomy terms are update/ saved. I know the default node tag is saved like node:1, node:2, but I'm confused on how to invalidate a ...
0
votes
1answer
17 views

How to make a list of all nodes of content type ABC on a site (not a sitemap)?

I have a D8 website with about 100 landing pages for a Google Ads campaign. All of my landing pages are of content type landing page. I want to make sure that the cache is primed for these pages ...
0
votes
2answers
262 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'] = [ ...
3
votes
1answer
2k views

Cache_page table gets massive [closed]

My cache_page table fills up immensely. I see that the expiry field has values = -1. I assume that means it never expires. Which could be why the table fills up so much. I wrote a hack to get around ...
0
votes
0answers
78 views

How to define caching for OutboundPathProcessor

I've got a customized OutboundPathProcesser that adds GET parameters to URLs starting from a specific node type targetting a specific node id. Basically whenever I'm on a node of type product, I add ...
-1
votes
1answer
48 views

js in default/files causes extreme slowdown of website [closed]

for the past week my website is plagued with over 4000ms hanging upon entering, more so at sometimes. After using firefox's performance monitor, I pinpointed it to several lines of code in a js file ...
0
votes
0answers
74 views

Setting custom block cache max-age to 0 breaks jQuery change event

I have a custom block in which I read a session value and display the result as the selected value of a select form element. Since the value can change based on the users selection, I'm setting cache ...
4
votes
2answers
1k 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 ...
2
votes
1answer
66 views

Hook or event before a page gets cached

Is there a hook or event I can tie into before a page gets cached. I need a hook/event that I can call so that I can run some logic on the page that is about to be cached to tell Drupal if I want a ...
0
votes
1answer
216 views

Show/hide menu link based on changing custom $tempStore value

I'd like to show/hide a main-menu link based on a $tempStore variable the user can set and modify during their session, i.e. user sets $tempStore['vlaue'] = 0; --> menu link is hidden user sets $...
4
votes
1answer
579 views

Invalidating render cache items for anonymous?

We have a certain content type in Drupal 8 that has a small grid of data on it that is populated from an API call when the node view is being built. In that call, I am checking for cache and setting ...

1 2 3
4
5
28