Removes all stored objects in a cache region. If no cache region is specified, objects in the default region are removed.

cacheRemoveAll( region ) → returns void

Argument Reference

region string

Indicates the cache region from which to remove the stored objects. If no value is specified, default cache region is considered by default.

Sample code invoking the cacheRemoveAll function

// generate some data to cache
for ( i = 1; i <= 10; i++ ) {
  cachePut( 'cache_#i#', "Test data #i#" );

function cacheObjCount() {
    return arrayLen(cacheGetAllIds());

_numCacheObj = "Number of objects in the cache: ";

writeOutput('Before cacheRemove() :: #_numCacheObj# #cacheObjCount()#<br />');

// clear all objects from the cache

writeOutput('After cacheRemove() :: #_numCacheObj# #cacheObjCount()#<br /><br />');

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub