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.
Removes all stored objects in a cache region. If no cache region is specified, objects in the default region are removed.
Nothing
ColdFusion 10: Added this function.
cacheRemoveAll(region__)
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. |
<!--- 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>