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
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 ...
35
votes
2answers
24k 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.
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 ...
26
votes
5answers
28k 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 ...
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 ...
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 ...
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?
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 ...
21
votes
7answers
57k 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 ...
21
votes
2answers
9k views

drupal_static() uses a FUNCTION variable,what does it mean?

function drupal_set_page_content($content = NULL) { $content_block = &drupal_static(__FUNCTION__, NULL); $main_content_display = &drupal_static('system_main_content_added', FALSE); ...
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
2k views

Best practices for implementing custom caching?

For every instance of every type of entity, I generate a number of caches, named something like: [module_name]__[entity_type]__[entity_id]__[string_depending_on_where_the_cache_came_from] Now ...
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 ...
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 ...
15
votes
9answers
7k views

Is there a way to hook on cache clearing?

For a big institution website, with heavy caches, I'd like to generate caches as soon as possible, so that no user may arrive on cache generation... I have a cron set all minutes that does it, by ...
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?
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: .....
14
votes
0answers
1k views

How do I setup Chained fast backend, Varnish, APCu and Redis cache bins in settings.php?

On a Debian Jessie server (Nginx, PHP 5.6, Zend Opcache), I installed Apcu, Redis, Varnish. I also installed APCu, Chained fast backend, Redis and Varnish modules. In order to make these caching ...
13
votes
5answers
16k 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 ...
13
votes
5answers
13k 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 ...
12
votes
3answers
12k views

How to keep cache_form small

I have noticed in mysql that cache_form.MYD table is 14GB. Why did it grow so big? Is it safe to empty it? and how can I avoid this happening in the future? Thanks
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?
12
votes
1answer
8k views

Using Memcache Effectively with Drupal 7 Multisite

I am setting a hit ratio of 55% on our memcache instance (v1.4.4) and am wondering what can be done to improve the hit ratio. We're in a multisite setup (30+ sites), with two load balanced web servers;...
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
4answers
8k views

Why can't I add another allowed file extension to a Drupal 7 image field?

I've added the SVG file extension for image uploads via admin/structure/types/manage/image/fields/gallery_image, as you see below: But when I go to upload an image, I'm still not allowed to ...
12
votes
3answers
6k views

Which tables should be emptied when clearing database-stored cache manually?

Prior to D8 to clear cache manually one could truncate all tables beginning with cache_. In Drupal 8 there are still tables starting with cache_, but there's also a cachetags table. Is the advice in ...
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 ...
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
13k 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.
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 ...
10
votes
6answers
24k views

Clear Cache without logging in

I added an if statement around the content render php in my page.tpl.php file. Only problem is I made a mistake and accidentally prevented it from rendering content on any page. I cleared the cache ...
10
votes
4answers
6k views

How do I cache the result of db_query()?

I used views_get_view_result() to get results from a view because it was convenient at that time. The query result rarely changes; I could use views caching for 6 days. If I wanted to convert it to a ...
10
votes
2answers
10k views

Fatal error: Call to undefined function cache_get() [closed]

I am getting the following error on the server Fatal error: Call to undefined function cache_get() in includes/module.inc on line 665 Drush command terminated abnormally due to an unrecoverable error....
10
votes
3answers
8k 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 ...
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 ...
9
votes
2answers
11k views

How to prevent caching of a page?

I've set a custom homepage url at example.com/welcome. The user comes to the example.com/ and logs in on that page. Drupal redirects to example.com/welcome Now the user clicks on the home page which ...
9
votes
3answers
2k views

Site performance , cache not working properly

I am using the Performance Logging Module. Above screenshot, one strange thing I noticed that Insert Cache_bootstrap on every page. When you go to any page (both admin theme and frontend theme) Insert ...
9
votes
2answers
27k 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?
9
votes
2answers
6k views

Disable cache for specific blocks

I would like to let pages continue to benefit from Drupal 8 caching mechanism for anonymous users, except for a specific blocks which should update on every page refresh knowing that they are ...
8
votes
6answers
13k views

Clear a single url from cache

Using Drupal's standard cache system, is there a way to clear the cache for a node or url without clearing the entire cache (which slows down the whole site)?
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, ...
8
votes
1answer
735 views

How to wildcard cache clear in Drupal 8?

In Drupal 7, we used to be able to do this: cache_clear_all('state:', 'cache', TRUE) which would delete any cache bin entires that started with the string state: (matching cache IDs such as state:...
8
votes
3answers
4k views

Caching using wget

I use drupal 7. After clearing the cache, I use wget like this to cache all pages back. wget --quiet http://xxx.xxx/sitemap.xml --output-document - | egrep -o "http://xxx.xxx[^<]+" | wget -q --...
8
votes
1answer
3k views

Where do I add a new cache context for an entity?

I have not been able to get adding a cache context to work for entities in drupal 8. Specifically I'm going for headers:User-Agent. I tried many variations on the following in a module. use ...
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 ...
8
votes
1answer
202 views

Does DRUPAL_CACHE_PER_PAGE count pager pages (i.e. frontpage?page=3)?

I guess my whole question is pretty much in the title... I'm wondering if blocks that use DRUPAL_CACHE_PER_PAGE get cached on pager pages (i.e. mysite.com/frontpage?page=3), or if the pager query is ...
7
votes
6answers
4k views

How to clear cache externally?

I'd like some help how to clear the cache using an external script. I have a script that adds nodes each night, and I'd also like it to clear the views cache so - without having to make out by myself ...
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 ...
7
votes
5answers
4k views

How can I invalidate a cache on a specific View?

I am facing a situation where I need to invalidate a specific View in order to initiate clearing the cache on that View. views_invalidate_cache() clears ALL cached Views data, for every View on the ...
7
votes
3answers
6k views

How do I invalidate cache of an embedded view?

I have a node type "Article" that contains a repeating Paragraphs field. One of the paragraph types let's the user embed a view using a entity reference field. When rendering an Article node ...