Whatever message this page gives is out now! Go check it out!

CacheIdExists

Last update:
May 18, 2026

Description

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.

Returns

True, if the cached object exists in the specified cache region.

History

ColdFusion 10: Added this function.

Syntax

cacheIdExists(id ,[region])

Properties

Parameter
Description
id
(Required) The ID of the cached object.
region
(Optional) The cache region where you check for the cached object.

Example: Checks if the cache object is present in the user-defined cache region

<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>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page