Attention! Helicon Tech Blog has moved to

Wednesday, May 12, 2010

Automatic cache cleaning in Helicon Ape

Up to version Helicon Ape cache could be cleaned only manually. Memory-based cache (mod_mem_cache) required recycling of corresponding application and disk-based cache (mod_disk_cache) cleaning implied manual files deletion form the file system. That was slightly inconvenient, to put it mildly.
Helicon Ape (and newer) got support of cache cleaning upon request.
Now, to clean cache just set the cache-clear environment variable. This will cause cache cleaning corresponding to the current request (context).

Setting cache-clear variable using SetEnvIf directive provides flexibility of conditions that will lead to cache cleaning.

For example, to trigger cache cleaning by requesting specific URL:
SetEnvIf request_uri ^/system/cache/clear/$ cache-clear=1
To trigger cache cleaning by appending specific query string value:
SetEnvIf Query_String clear_cache_request cache-clear=1
For security purposes it may be necessary to clean cache only from definite IP address:
SetEnvIf (Query_String clear_cache_request) and (Remote_Addr 11\.22\.33\.44) cache-clear=1
Cache cleaning may take some time, so be ready.

When cache cleaning is over, the error.log (with info or higher verbosity level) will display the number of deleted records.

Best regards,
Ruslan, Anton - Helicon Tech Team