User Guide Cancel

CacheGetAllIds

 

Description

Gets the IDs of all objects stored in the cache.

Returns

An array containing the IDs of all the objects that are stored in the cache.

Category

Cache functions

Function syntax

CacheGetAllIds(cacheName, isAccurate)
CacheGetAllIds(cacheName, isAccurate)
CacheGetAllIds(cacheName, isAccurate)

Parameters

Parameter

Description

cacheName

The name of the cache region

isAccurate

(Optional) Boolean. Default is True. When set to false, CacheGetAllIds will return the result faster. However, the result may not be accurate.

If you need only the IDs of valid (unexpired) objects from the cache, set accurate to true. If you set accurate to false, the IDs of all the objects in the cache will be returned.

See also

cfcacheCachePutCacheGetCacheGetMetadataCacheGetPropertiesCacheRemoveCacheSetProperties

History

ColdFusion (2018 release): Renamed parameters Region to cacheName and accurate to isAccurate.

ColdFusion 11: Added the parameter accurate.

ColdFusion 10: Added the parameter region.

ColdFusion 9: Added the function.

Example

<cfscript>
// create a cache region with no properties
rProps={};
CacheRegionNew("myRegion",rProps,true);
// create cache timespan and idle time
timeToLive = CreateTimeSpan(0, 0, 30, 0);
timeToIdle = CreateTimeSpan(0, 0, 30, 0);
// define objects to be inserted into cache region
foo1=foo2=foo3={};
// populate the cache with ids and objects
cachePut("1", "foo1", timeToLive, timeToIdle, "myRegion");
cachePut("2", "foo2", timeToLive, timeToIdle, "myRegion");
cachePut("3", "foo3", timeToLive, timeToIdle, "myRegion");
// display the ids. Ids are displayed as array
Writedump(CacheGetAllIds("myRegion",true));
</cfscript>
<cfscript> // create a cache region with no properties rProps={}; CacheRegionNew("myRegion",rProps,true); // create cache timespan and idle time timeToLive = CreateTimeSpan(0, 0, 30, 0); timeToIdle = CreateTimeSpan(0, 0, 30, 0); // define objects to be inserted into cache region foo1=foo2=foo3={}; // populate the cache with ids and objects cachePut("1", "foo1", timeToLive, timeToIdle, "myRegion"); cachePut("2", "foo2", timeToLive, timeToIdle, "myRegion"); cachePut("3", "foo3", timeToLive, timeToIdle, "myRegion"); // display the ids. Ids are displayed as array Writedump(CacheGetAllIds("myRegion",true)); </cfscript>
<cfscript>
       // create a cache region with no properties
       rProps={};
       CacheRegionNew("myRegion",rProps,true);
       // create cache timespan and idle time
       timeToLive = CreateTimeSpan(0, 0, 30, 0);
       timeToIdle = CreateTimeSpan(0, 0, 30, 0);
       // define objects to be inserted into cache region
       foo1=foo2=foo3={};
       // populate the cache with ids and objects
       cachePut("1", "foo1", timeToLive, timeToIdle, "myRegion");
       cachePut("2", "foo2", timeToLive, timeToIdle, "myRegion");
       cachePut("3", "foo3", timeToLive, timeToIdle, "myRegion");
       // display the ids. Ids are displayed as array
       Writedump(CacheGetAllIds("myRegion",true));
</cfscript>

Get help faster and easier

New user?