Drupal - Clear a single url from cache

The module Cache actions provide very fine grained control over your cache clearing.

Unfortunately, whether it will solve your exact problem depends on how this particular url is built up. In case it doesn't do exactly what you want, it's codebase would still be an excellent start for building more exactly what you need.


Yes you can do it programmatically also.

In this example we clear the front page cache :

$url = url('<front>',  array('absolute' => TRUE));

cache_clear_all($url, 'cache_page');

Drupal stores the paths as CID in table and in above example we are providing front page URL as CID as a first argument in the function and if you define the CID, it is mandatory to define the second argument $bin in the function, which is like from which table you want to delete cache. As we have to delete a single page, so its present in cache_page which holds cache for pages.


There is a module for that: Flush page cache. Here is a quote about it (from the module's project page):

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.

Tags:

Caching