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
22
votes
10answers
5k views

Can I turn cache off for the development deployment?

On development platform caching can be a pain. Can I turn it off? Will it affect any of the modules that require it?
21
votes
7answers
56k 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 ...
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 ...
23
votes
4answers
10k views

Are views cached through the core caching mechanisms or should I be setting the caching directly in each view?

I see there are cache settings in each of my views. Do I need to set these or does the core caching mechanisms in /admin/config/development/performance automatically do some of this and these "extra ...
7
votes
4answers
4k views

Anonymous user cache control

We have written some custom blocks that render dynamic content; unfortunately, the caching defaults cache the first render of this block (and don't refresh for anonymous users). Cache control seems to ...
2
votes
4answers
5k views

Change module's weight - by module or manualy

I am looking for solution how to change particular module's weight in D7. I know that it is possible to do in config tables in database, but I don't know how. Another solution that I found in Drupal....
54
votes
9answers
4k views

Real world experience in scaling and tuning performance

The website I'm working is allegedly going to have a massive hit rate soon after launch. The client is talking about the possibility of around 2500 hits per second over a day or so. Ignoring the ...
17
votes
7answers
18k views

How do I correctly setup caching for my custom block showing content depending on the current node?

I have this very basic block which just shows the current node's ID. <?php /** * @file * Contains \Drupal\mymodule\Plugin\Block\ExampleEmptyBlock. */ namespace Drupal\mymodule\Plugin\Block; ...
17
votes
2answers
4k views

What all contributes to drupal page execution time?

I have a site I am investigating that has major performance issues, using memcache I was able to bring number of queries down both in number and total exectution time ( from 3 secs to 230 ms) but the ...
13
votes
5answers
15k 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 ...
15
votes
4answers
263 views

Can any of the cache_* be emptied safely?

Sometimes when moving the database it can be too large. Can any of the "cache_" prefixed tables be emptied without causing problems?
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 = $...
3
votes
1answer
2k views

Whenever I edit/update a node all the page caches for anonymous user are lost

I have the following cache settings on the performance page I have visited a few pages as anonymous user and made sure that they are being cached. Now I log in as admin in a different browser and ...
4
votes
4answers
4k views

After logging off, a user is able to see the pages by pressing back button of the browser

I have a requirement in which the user should not be able to see the books in the site unless he is logged in. And the user is not able to see the content. The problem is when a user logs in, views a ...
35
votes
2answers
23k views

Difference between Minimum cache lifetime and Expiration of cached pages

On Drupal Performance Page, under the fieldset Cache you have two options. One is Minimum Cache Lifetime and the other is Expiration of cached pages. What is the difference between these two.
16
votes
3answers
28k views

Best APC settings to reduce page execution time

I have Drupal 7, apc with php-fpm and apache behind varnish and512 MB RAM. I measure page execution time with devel module. Database query time is low (62ms) compared to page execution time which is ...
23
votes
3answers
3k views

Is it redundant to use the “boost” module if varnish is used?

We run our Drupal instances behind a Varnish server, but we're looking at alternative/additional ways to speed up the site. Boost is a module that is frequently named for this purpose; it appears to ...
3
votes
1answer
5k views

Drupal 7: Database select query FROM cache_bootstrap brings server down

The below query occasionally takes up to 24 sec and consumes the complete server resources. SELECT cid, data, created, expire, serialized FROM cache_bootstrap WHERE cid IN ('variables'); I was ...
10
votes
2answers
13k views

How to delete cache after updating/deleting/adding new content using hooks?

We have a custom services module and a site in Drupal 7, and I got the task to delete the cache after the editor adds new content or update the existing ones. I've read about a module called Cache ...
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))->...
5
votes
2answers
3k views

Turn off Twig cache

I did Disable Drupal 8 caching during development step by step ( also finally rebuild the cache) but yet my changes in twig files not take effects without rebuild the cache. sites/default/services....
1
vote
1answer
455 views

How to get cache metadata from nested render array when returning response?

I have a controller action that renders a list nodes and returns them, and only them. It's invoked via AJAX and the JS code just takes the result and inserts it into the page somewhere. My problem is ...
5
votes
2answers
1k views

How can I add cache context to custom menu link?

I have two routes that receive user as route parameter, and i need a menu link for every one in account menu. So I added in my *links.menu.yml client_account_links: deriver: \Drupal\my_module\...
1
vote
1answer
1k views

Cache page based on cookie value and URL

I am working on a site that is multi-lingual as well as multi-country. This means that pages will show content differently depending on a country cookie that is set when the user first visits the site....
10
votes
3answers
12k views

How Do I improve the performance of my Drupal7 Site? [closed]

For somebody who is new to Drupal, I see that there are many resources available on Drupal Caching but I am not sure which of them to use.
14
votes
4answers
17k 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: .....
12
votes
1answer
6k views

Implementing Custom Cache Tags

I would like to use the new Cache Tagging in D8 to help keep related content of different types (entities, nodes, blocks, etc) in sync. But from reading the currently available documentation of this ...
12
votes
6answers
6k views

`drush cc all` command takes too long time, what can I do?

On a site of mine drush cc all takes more than 4 mins to run. The site db is a few GBs. However, I cannot see a clear reason as to why it takes too long. What can I do to locate the bottle neck?
4
votes
1answer
867 views

Twig cache won't disable

I've set up my development setup and it works great but for some reason I can't get the twig cache to disable. I tried everything, but I have to run drush cr every time I change anything in twig ...
8
votes
2answers
5k views

How to theme Panels properly?

I am using Page Manager and Panels, providing custom node panels with selection rules by type (e.g. one panel variant for article-, one panel variant for blog-content type). This works smooth so far, ...
5
votes
2answers
2k views

Block cache not clearing on save?

I have some custom block types that display in a region in my site. I have noticed that when changing the contents of these blocks, like an image, text, or title, that when you save and visit the page,...
4
votes
2answers
3k views

How to refresh entity from entity_load(), reloading the entity as it is now?

If an entity has already been loaded, entity_load() retrieves it from memory rather than reloading it. Makes sense. But: what can you do when you need to reload an entity that has already been ...
2
votes
1answer
391 views

Is it proper to perform a db_update on an entity table?

I have a custom entity. During a save operation, under certain circumstances, I need to change the value of a specific field (not field API) of some other entities (of the same type). If I perform a ...
5
votes
3answers
7k views

How do I prevent a form from being cached for anonymous users?

I have a form that is pre-populated with information specific to an anonymous user's session information. However, the form appears to get cached for all anonymous users by default. 'Internal Dynamic ...
4
votes
1answer
3k views

Is there any gain using Memcached module when APC is running good on large Drupal 7 site (one server)

I am successfully using the APC Cache module on my prod website (single server). APC is performing good, caching is done very well. I wonder could I gain anything more by implementing Memcache. I ...
3
votes
1answer
2k views

Cached “Page not found” for anonymous users

My site's drupal version is 6.19. There are always logs like the following. the recent log entries shows type: page not found location:http://www.example.com/display.html referrer: message: 500....
3
votes
1answer
830 views

What is the memcache report screen telling me?

I'm experimenting with memcache and installed it via these instructions on a dev box. I think I have it working. The config file is mostly left at default: # cat /etc/sysconfig/memcached PORT="...
2
votes
2answers
2k views

Optimal Settings.php for Pressflow + Varnish + memcache

I am using pressflow having varnish + boost + memcache and also using cloudflare caching, I have seen some variable forms of settings.php file on forums and I am confused whether mine is optimal for ...
1
vote
3answers
2k views

Setting cache max-age to 0 has no effect on Block built using BlockBase?

I've built a custom block using BlockBase and as the content this block displays is different depending on the URL it's accessed via (a query parameter is passed in the URL) this block needs to either ...
1
vote
2answers
3k views

After enabling MySQL replication getting deadlocks when clearing cache

I recently setup my production MySQL server for replication. To do this I enabled innodb_flush_log_at_trx_commit and sync_binlog and set bind-address. A slave server on the opposite corner of the US ...
22
votes
4answers
6k views

Best way to optimize for authenticated user performance?

The keyword here is authenticated! Currently (as far as I know) the de-facto ways to optimize for anonymous access are through static page caches (varnish/squid/boost). However, as far as I know ...
30
votes
4answers
4k views

Memory-saving cache-clearing strategies for large sites?

One of my Drupal 7 sites has thousands of fields, a bunch of content types, more than 25 views, and hundreds (soon to be thousands) of profile types. Because of this, I'm using a core patch that ...
12
votes
2answers
7k views

Using Drupal 7 with APC, Varnish and Memcache, what bins to put in which cache?

I'm optimizing a Drupal 7 website and I have varnish, memcache and APC all installed and working with their individual Drupal 7 modules. In my settings.php I have the $conf options below. My question ...
26
votes
5answers
27k views

How to completely turn off caching?

I am developing a site in Drupal 7 and caching slows my work significantly. For example, I had a theming function for a form. I was puzzled, why doesn't it work. Until I cleared the cache and it was ...
11
votes
2answers
16k views

Clear cache doesn't clear the cache tables?

I don't fully understand the Clear Cache action. I just click in clear cache Clear All caches in: admin/config/development/performance , then I go to the database to check all cache_... tables and I ...
10
votes
3answers
7k views

If you update a routes file in Drupal 8 how do you clear the cache?

Having worked with Drupal 7 since its launch, I'm learning Drupal 8. At the moment I'm finding that whenever I change anything I have to do drush cache-rebuild to get things working again. On my VPS ...
8
votes
2answers
3k views

How to cache forms with a reverse proxy and deal with stale form tokens?

When Form API generates a form, it also generates a token that is passed out with the form in a hidden field, and expected to be returned back. If it is, the form is processed. If a rendered form ...
4
votes
2answers
683 views

Views vs Performance

I'm designing a huge media site. It would need to have about 20 views on the homepage and should attract about 100,000 visitors daily. The site is hosted on a dedicated server. Other than setting up ...
10
votes
3answers
7k views

What is the correct way to set cache contexts on custom blocks?

I have run into an issue where a block that should be unique per page isn't for logged-out users. The issue is a custom block plugin I have on a views search page that contains custom filters (sort ...
9
votes
2answers
26k views

How to check that cache is working on current page?

Some modules silently turn off caching on certain pages. How is the easiest way to check that this is the case and also identify problematic module?