Life’s Lustre

Archive for the ‘Bugs & Tricks’ Category

For quite long time I am searching for ways to handle the CACHE problem in drupal development environment.

Today while going through some core modules I found a API function (cache_clear_all) that is used at many places for cache clearing.

It expires data from the cache. If called without arguments, expirable entries will be cleared from the cache_page table. (Drupal has 6 such tables) .

Function Info: cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE)

$cid If set, the cache ID to delete. Otherwise, all cache entries that can expire are deleted.

$table If set, the table $table to delete from. Mandatory argument if $cid is set.

$wildcard If set to TRUE, the $cid is treated as a substring to match rather than a complete ID. The match is a right hand match. If ‘*’ is given as $cid, the table $table will be emptied.

We can call this function within any function whenever we require to clear the cache.

Now I will try to use this efficiently and will let you know if found any interesting benefit.

Keep visiting this blog…..


Follow

Get every new post delivered to your Inbox.