CacheGetMetadata

Description

Gets the metadata values for a cached object and template caches.

Returns

A structure containing the cached object metadata. The structure has the following fields:

Structure element

Description

cache_hitcount

The number of cache entries have been used.

cache_misscount

Number of times the object was requested, but was not in the cache or was not up to date (was stale).

createdtime

The time when the element or object was cached.

hitcount

Number of times the cached object has been used.

idletime

The remaining time, in seconds, after which the cached object is purged if it is idle.

lasthit

The time the cached object was last used, as a date-time object, or the empty string.

lastupdated

The time the cached object was last modified, as a date-time object, or the empty string.

size

The number of bytes the object takes up when serialized.

timespan

The remaining time, in seconds, during which the cached object is valid.

Category

Cache functions

Function syntax

CacheGetMetadata(id, [cacheType,region])

See also

cfcache CachePutCacheGetCacheGetAllIdsCacheGetPropertiesCacheRemoveCacheSetProperties

History

ColdFusion (2018 release): Renamed the parameter template to cacheType.

ColdFusion 10: Added the parameter region

ColdFusion 9.0.1: Added the parameter template

ColdFusion 9: Added the function

Parameters

Parameter

Description

id

The ID of the cached object.

cacheType

Gets metadata for template caches.

region

(Optional) The name of the cache region.

Example

<cfcache action="cache" timespan="#CreateTimeSpan(0,0,10,0)#" useQueryString="true" metadata="cachemetadata"> 
<cfoutput>-This date/time IS cached: #Now()#-<br /></cfoutput> 
</cfcache>

getMetaDataTemplate.cfm

<cfcache action="flush"> 
<!--- contruct the templatecacheid to pass to the getcachemetadata function ---> 
<cfset baseurl = "http://#cgi.server_name#:#cgi.server_port##getDirectoryFromPath(cgi.script_name)#cacheTemp.cfm"> 
<cfset pageid = hash(expandpath('cacheTemp.cfm'))> 
<cfset lineno = 1> 
<cfset templateCacheId = trim(ucase("#baseurl#_PAGEID:#pageid#_LINE:#lineno#"))> 
<!--- cache the template ---> 
<cfhttp url="#baseurl#" /> 
<cfdump var="#getAllTemplateCacheIds()#"><br> 
<!--- work with the returned metadata ---> 
<cfset templateMetaData = cachegetmetadata(templatecacheid,'Template')> 
<cfdump var="#templateMetaData#">

 Adobe

Recevez de l’aide plus rapidement et plus facilement

Nouvel utilisateur ?

Adobe MAX 2024

Adobe MAX
La conférence sur la créativité

Du 14 au 16 octobre à Miami Beach et en ligne

Adobe MAX

La conférence sur la créativité

Du 14 au 16 octobre à Miami Beach et en ligne

Adobe MAX 2024

Adobe MAX
La conférence sur la créativité

Du 14 au 16 octobre à Miami Beach et en ligne

Adobe MAX

La conférence sur la créativité

Du 14 au 16 octobre à Miami Beach et en ligne