Removes an object from the cache.
cacheRemove(id [, throwOnError [, region[, exact]]])
→ returns void
false
true
throws an error when cache ID does not exist.
true
true
, matches values in id
exactly
cacheRemove( 'myCachedQuery' );
Remove using partially matching IDs
cachePut( 'cache_1', 'test data', 1000, 1000, 'test' );
cachePut( 'cache_2', 'test data', 1000, 1000, 'test' );
// this removes both cached objects:
cacheRemove( 'cache', false, 'test', false );
With exact set to true, no IDs match, so none will be deleted
cachePut( 'cache_1', 'test data', 1000, 1000, 'test' );
cachePut( 'cache_2', 'test data', 1000, 1000, 'test' );
// this removes no object:
cacheRemove( 'cache', false, 'test', true );
(ColdFusion 10 added cacheRemoveAll.)
<cfset allCacheIDs = cacheGetAllIds( ) />
<cfif not arrayIsEmpty( allCacheIDs )>
<cfset cacheRemove( allCacheIDs ) />
</cfif>
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.