Whatever message this page gives is out now! Go check it out!
<cfcache
action = "action"
dependsOn = "variable name list"
directory = "directory path"
expireURL = "wildcarded URL reference"
id = "object identifier"
idleTime = "decimal number of days"
metadata = "variable name"
name = "variable name"
password = "password"
port = "port number"
protocol = "http://|https://"
region = "region_name"
stripWhiteSpace = "false|true"
throwOnError = "false|true"
timespan = "decimal number of days">
useCache = "true|false"
usequerystring = "false|true"
username = "username"
value = "value">
The page fragment to be cached, if any.
</cfcache>Attribute | Actions | Req/Opt | Default | Description |
action | All | Optional | serverCache |
|
dependsOn | cache, serverCache , optimal | Optional | A comma separated list of variables. If any of the variable values change, ColdFusion updates the cache. This attribute can take an expression that returns a list of variables. | |
directory | cache, serverCache , clientCache , optimal, flush, put | Optional | Cache in memory | Absolute path of cache directory. |
expireURL | flush | Optional | Flush all cached pages | A URL reference. Can include wildcards, for example: "/ view.cfm ?id=". ColdFusion flushes, from the cache, pages that match the specified URL or pattern. |
id | flush, get, put | See description | The identifier for a cached object. This attribute can also take a comma-separated list of identifiers. This attribute is required for the any operation on an object. Therefore it is required for the get and put actions, and to flush an object. It is not required to flush a page. | |
idleTime | cache, serverCache , clientCache , optimal, flush, put | Optional | No idle timeout | Flushes the cached item if it is not accessed for the specified time span:
|
metadata | get | Optional | The name of a structure variable in which to put object metadata. The get operation returns the following data:
| |
name | get | Required | The name of the variable in which to put the retrieved object. | |
password | cache, serverCache , clientCache , optimal, flush | Optional | A password. Provide this if the page requires authentication at the web-server level. | |
port | cache, serverCache , clientCache , optimal, flush | Optional | The port for the current page | Port number of the web server from which the URL for the cached page is requested. In the internal call from cfcache to cfhttp , ColdFusion resolves each URL variable in the page; this ensures that links in the page remain functional. |
protocol | cache, serverCache , clientCache , optimal, flush | Optional | The current page protocol | Protocol that is used to create URL from cache .
|
region | Optional | Name that you assign to a cache region | ||
stripWhiteSpace | cache, serverCache , optimal | Optional | false | Specifies whether to strip any unnecessary white space characters from a cached page fragment. Does not have any effect on cached pages or objects. |
throwOnError | flush with id attribute | Optional | false | A Boolean value specifying whether to throw an error if the flush action encounters an error. Otherwise the action does not generate an error if it fails. If this attribute is true you can handle the error in a cfcatch block, for example, if a specified id value is invalid. |
timespan | cache, serverCache , clientCache , optimal, flush, put | Optional | See Description | The interval until the item is flushed from the cache.
|
useCache | cache, serverCache , optimal, | Optional | true | Specifies whether to use caching for a page. This attribute can be useful during development. For example, you could use a function to predict when to use a cache, based on the application state. |
useQueryString | Optional | false | If true, generates a template cache ID that includes the query string. This means that a new template cache is created whenever the query string changes. If set to true, the attribute dependson considers the URL parameters defined in the query string as well to generate template caches. Also see the Usage section | |
username | cache, serverCache , clientCache , optimal, flush | Optional | A username. Provide this if the page being cached or flushed requires authentication at the web server level. | |
value | put | Required | The object to cache. |
<cache name="cf"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="86400"
timeToLiveSeconds="86400"
overflowToDisk="true"
diskSpoolBufferSizeMB="30"
maxElementsOnDisk="10000000"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="3600"
memoryStoreEvictionPolicy="LRU"/><cfcache key="cf" timespan=#createtimespan(0,0,1,0)# >
<cfoutput>#now()#</cfoutput>
<cfcache><!---Cache this template for 30 seconds --->
<cfcache action="servercache" timeSpan="#createTimeSpan(0,0,0,30)#">
<!---Display the current time --->
<cfoutput>
#timeFormat(now(),"hh:mm:ss tt")#
</cfoutput>