CachePut()
Stores an object in the cache, with a life time and an idle time.
CachePut( id=string, value=object, timeSpan=timespan, idleTime=timespan, cacheName=string );
Returns: void
| Argument | Description |
|---|---|
|
id
string,
required
|
edit
The id for the cache object. Alias: key, name |
|
value
object,
required
|
edit
The value of the object. |
|
timeSpan
timespan,
optional
|
edit
The interval until the object is flushed from the cache, as a decimal number of days. One way to set the value is to use the return value from the CreateTimeSpan function. The default is to not time out the object. |
|
idleTime
timespan,
optional
|
edit
A decimal number of days after which the object is flushed from the cache if it is not accessed during that time. One way to set the value is to use the return value from the CreateTimeSpan function. |
|
cacheName
string,
optional
|
edit
definition of the cache used by name, when not set the "default Object Cache" defined in Lucee Administrator is used instead. Alias: cache, region |
Examples
edit<cfset cacheput_obj = now()>
<cfset cachePut('cacheput_obj',cacheput_obj,createTimespan(0,0,0,30),createTimespan(0,0,0,30),'region_cachename')>
//In above region_cachename is, should be creates a cache from lucee_administrator
<cfoutput>Cache Exists is <b>#cacheIdExists('cacheput_obj','test_cache')#</b></cfoutput>
See also
- Cache
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)