CacheGetMetadata()
returns a structure with some Metadata regarding the cache elements (keys returned depends on the Cache type used).
CacheGetMetadata( id=string, cacheName=string );
Returns: Struct
| Argument | Description |
|---|---|
|
id
string,
required
|
edit
name of the element you need metadata for Alias: name, key |
|
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// define a RAM cache as the default object cache
application action="update" caches="#{ trycf: {
class: 'lucee.runtime.cache.ram.RamCache',
custom: { timeToIdleSeconds: 3600, timeToLiveSeconds: 3600 },
default: 'object'
}}#";
cacheClear();
cachePut( "myKey", "hello world" );
// returns a struct with metadata about the cache entry
// the exact keys depend on the cache implementation
meta = cacheGetMetadata( "myKey" );
dump( meta );
// typical keys include: created, lastHit, lastAccessed, hitCount, idleTime, timeSpan
See also
- Cache
- Getting Started with Caching
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)