2

I have a large site which uses Drupal cores 'page caching for anonymous users'. I have made some javascript changes which I need to deploy. Since pages are currently cached I will need to clear the page cache.

I am wondering if there is a way of only clearing the page cache? If possible I don't want to have to rebuild any other caches (e.g. menu).

I know Drush provides a certain level of granularity when it comes to caching; however, it would appear that Drush is not capable of only clearing the page cache

$ drush cc

Enter a number to choose which cache to clear.
 [0]   :  Cancel         
 [1]   :  all            
 [2]   :  drush          
 [3]   :  theme-registry 
 [4]   :  menu           
 [5]   :  css-js         
 [6]   :  block          
 [7]   :  module-list    
 [8]   :  theme-list     
 [9]   :  registry       
 [10]  :  metatag        
 [11]  :  token          
 [12]  :  views
1
  • cache_clear_all(NULL, 'cache_page'); ?
    – Clive
    Aug 13, 2015 at 8:47

2 Answers 2

3

You can use Flush Page Cache or Cache Actions module.

See if either of them solves your problem.

Flush Page Cache:

Easing the pain when you need to flush...Drupal's cache.

Flushing Drupal's cache on a large site can feel like you're waiting to takeoff on the tarmac at JFK. The delay comes from the fact that when you clear Drupal's cache, it clears everything. Most of time you just want to flush the cache for specific object on a page.

The Flush page cache module solves this problem by flushing only the cached objects for a single page. Additionally, you can define custom objects and cache tables to be cleared on specific pages.

Cache Actions:

Cache actions provides rules actions for clearing drupal caches.

It currently provides actions for:

  • Clearing Drupal cache bins
  • Clearing CSS/JS cache
  • Clearing The cache of specific views
  • Clearing The cache of specific panel pages
  • Clearing The cache of specific mini panels
1
0

Using only drush, you can use php-eval to run this:

drush php-eval "cache_clear_all(NULL, 'cache_page');"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.