Cache Exclude


Drupal's cache system is pretty simple. Basically, you can cache all pages trough the administration. But what happen if you need to exclude a page from caching?


Imagine that you need to create a view for your homepage that will sort nodes in a random display. The solution is very simple. With views, you just need to add a Global: Random (asc)​ into your sort criteria.
But there is a problem. If, by default, you activated the cache pages for anonymous user, your random view will not work. In fact, your view will always display the same content. 

In order to make your random view working, you need to uncheck the page cache system for anonymous users. But, as all the website will not be cached, this will seriously improve you perfomance. So what is the solution? Could we activated the cache system for the global pages and exclude or uncached only one page?

Cache system

The cache system of Drupal is very basic. It stores the HTML of the page together with the URL for anonymous users. Even more basic, Drupal's page caching works only for anonymous users (i.e, not logged in).That's all. 

Exclude cache module

The best way to exclude a page from the Drupal's cache system is to install the CacheExclude module ( Then, you just need to activated it and configure it. The configuration is very simple. You have to write URL's that have to be excluded from cache system. You can add several URLS (one for each line) or write <front> for the homepage.