Working with Caches in Drupal 7

Working with Caches in Drupal 7, If you have made any changes to theme or module, that doesn’t effect website until clearing the caches. Cache means temporary stored files on disk, instead of processing all the data from web server to database and rendering it to browser. Drupal creates a cached copy of your website with specific time intervals, while caching drupal will creates all pages as static html. So any user can access it easily.

Working with Caches in Drupal 7 is an article in the series of Step by step guide to learn drupal7.

#Part 2 @ Day 9
Benefits of enabling cache, it will decrease the server load because every time there is no need to process all code and database queries, improved page load time because static pages will be served to user. Faster user experience.

Normally drupal cached copy files are created at a fixed interval of time like 1 hour or 6 hours based on your drupal configuration. If you are working on development drupal website, and you want to clear the cache, enable or disable cache. Follow these steps.

  1. Clearing caches in drupal 7
  2. Enabling cache in drupal 7
  3. Disabling cache in drupal 7
1

Clearing Caches in drupal 7

For clearing caches in drupal 7, login to drupal administrative section.

  • Navigate to Drupal Administration => Configuration => Development => Performance.
    http://example.com/admin/config/development/performance
  • On that page, you can see Clear all caches button. Under clear cache title.
    Clear cache button drupal 7

    Clearing caches in drupal 7

  • Click on that button, it will take few minutes to clear, after that you can see a notification message that shows caches cleared.
    Clear cache button drupal 7 cleared message

    Showing caches cleared message after clearing caches in drupal 7

If you are using drupal administrative menu, then you can clear individual caches.

  • First login to drupal administrative panel.
  • Hover over the drupal icon on the left side from administration menu bar.
  • A fly out menu will be displayed.
  • Hover on Flush all caches, all possible options for clearing caches will be shown.
    Clearing caches through drupal administrative menu

    Clearing caches through drupal administrative menu

  • Click on appropriate option, or else click on Flush all caches link.
    Clear cache success mesage flush all caches

    Flush all caches from administrative menu

    Clearing caches in drupal 7 clear theme registry

    Notification after clearing theme registry from administrative menu

  • It will takes few minutes to clear cache, then caches cleared message will be displayed.
2

Enable Cache in drupal 7

For enabling caches in drupal, just follow these steps

  • Login to drupal Administrative panel, Drupal administration => Configuration => Development => Performance.
    Enable caches in drupal 7

    Enable caches in drupal 7

  • Under caching, select the check box “Cache pages for anonymous users“.
  • If you want to enable caching for blocks, select the check box “Cache Blocks“.
  • Specify the Minimum cache life time from drop down menu.
  • Specify Expiration of cached pages from drop down menu.
  • If you want to optimize(minify) js, css files. Select two check boxes under Bandwidth optimization.
  • Then click on save changes.
3

Disable Cache in drupal 7

For disabling cache in drupal 7, follow these steps.

  • Login to drupal Administrative panel, Drupal administration => Configuration => Development => Performance.
  • Un check all the select boxes.
  • Then click on save changes.

I hope this article helped you to learn working with caches in drupal 7. To get latest news and updates follow us on twitter & facebook, subscribe to newsletter. If you have any feedback please let us know by using comment form.

Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply:

x

Join My Facebook Group to Receive Coding Tutorial for Free

email-subsribe