Used to find if a cached object exists in the cache region. The region can be the default cache region (either at server or application level) or the custom region you specify.
True, if the cached object exists in the specified cache region.
ColdFusion 10: Added this function.
cacheIdExists(id ,[region])
Parameter |
Description |
|---|---|
id |
(Required) The ID of the cached object. |
region |
(Optional) The cache region where you check for the cached object. |
<cfscript>
// Create a new object
obj1 = {};
obj1.name = "hello world";
// Define the time to live and time to idle parameters
timeToLive=createtimespan(0,0,0,30);
timeToIdle=createtimespan(0,0,0,30);
writeOutput("Starting to write to cache..");
cachePut("id_obj1",obj1,timeToLive,timeToIdle,"customcache");
writeOutput("Done!!");
writeOutput("Trying to check if the cached item is present...");
writeOutput(cacheIdExists("obj1","customcache"));
</cfscript>
Sign in to your account