CacheClear()
Flushes a cache
CacheClear( filterOrTags=any, cacheName=string );
Returns: Number
| Argument | Description |
|---|---|
|
filterOrTags
any,
optional
|
edit
You can define 2 different things here:
Alias: filter, tags, tag |
|
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'
}}#";
// store some values
cachePut( "fruit:apple", "red" );
cachePut( "fruit:banana", "yellow" );
cachePut( "vehicle:car", "blue" );
dump( cacheCount() ); // 3
// clear only keys matching a wildcard filter
cacheClear( "fruit:*" );
dump( cacheCount() ); // 1 — only vehicle:car remains
// clear everything
cacheClear();
dump( cacheCount() ); // 0
See also
- Cache
- Getting Started with Caching
- SystemCacheClear()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)