Description

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

Returns

Nothing

History

ColdFusion 10: Added this function.

Syntax

cacheRemoveAll(region__)

Properties

Parameter

Description

region

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

Example

<!--- clear all object caches ---> 
<cfif ArrayLen(cacheGetAllIds()) gt 0> 
<cfset cacheRemove(ArrayToList(cacheGetAllIds()))> 
</cfif> 

<!--- create few caches ---> 
<cfloop from="1" to="10" index="i"> 
<cfset id = "cache_#i#"> 
<cfset timeToLive = CreateTimeSpan(0,0,30,0)> 
<cfset timeToIdle = CreateTimeSpan(0,0,30,0)> 
<cfset cachePut(id,createQryObj(i),timeToLive,timeToIdle)> 
</cfloop> 
<cfoutput>Before cacheRemove() :: Number of objects in the cache: #ArrayLen(cacheGetAllIds())#<br></cfoutput> 

<!--- clear all objects from the cache ---> 
<cfset cacheRemoveAll()> 

<cfoutput>After cacheRemove() :: Number of objects in the cache: #ArrayLen(cacheGetAllIds())#<br><br></cfoutput>

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy