The entry BIF into the BoxCache.
This BIF will retrieve a named cache registered in our cache service. If you don't pass a cache name, it will default to the {@code default} cache.
Once you have an instance to a cache, you can use the various methods to interact with the cache. Every cache must adhere to the {@link ICacheProvider} interface.
Puts HTML page into the cache and uses the cached version on subsequent calls to the page.
Result:
Hello World!
Flushes the 'hello-world.bxm' page from the cache.
Cache(cacheName=[string])cacheName
string
false
The cache name to retrieve the id from, defaults to {@code default}
default
<bx:cache action="optimal" directory="/path/to/directory" timespan="#createTimeSpan( 1, 0, 0, 0 )#" idletime="#createTimeSpan( 0, 12, 0, 0 )#">
<div id="some-id">Hello World!</div>
</bx:cache><bx:cache action="flush" directory="/path/to/directory" expireURL="/hello-world.bxm"/>This method creates a cache filter that can be used to operate on a cache instance and its keys.
The filter can be used to clear, get, or remove keys from the cache.
All filters must be adhere to the {@link ICacheKeyFilter} interface.
Example:
cache().clear( cacheFilter( "foo*" ) );
cache().clear( cacheFilter( ".*foo.*", true ) );
You can also create your own custom cache filter by using a closure/lambda that
accepts a {@code
Key
} and returns a boolean.
Example:
cache().clear( key -> key.getName().startsWith( "foo" ) ); cache().clear( key -> key.getName().matches( ".*foo.*" ) );
Method Signature
CacheFilter(filter=[string], useRegex=[boolean])
Arguments
Examples
Related