All pages
Powered by GitBook
1 of 6

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Cache

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.

Method Signature

Arguments

Argument
Type
Required
Description
Default

Examples

Adding a page to the cache

Puts HTML page into the cache and uses the cached version on subsequent calls to the page.

Result:

Hello World!

Flushing a page from the cache

Flushes the 'hello-world.bxm' page from the cache.

Related

Cache(cacheName=[string])

cacheName

string

false

The cache name to retrieve the id from, defaults to {@code default}

default

CacheFilter
CacheNames
CacheProviders
CacheService
<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"/>

CacheProviders

Get an array of all the registered cache providers in BoxLang

Method Signature

CacheProviders()

Arguments

This function does not accept any arguments

Examples

Related

Cache
CacheFilter
CacheNames
CacheService

CacheFilter

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




cache

CacheService

Get access to the Box Cache services

Method Signature

CacheService()

Arguments

This function does not accept any arguments

Examples

Related

Cache
CacheFilter
CacheNames
CacheProviders

CacheNames

Get an array of all the registered caches in BoxLang

Method Signature

CacheNames()

Arguments

This function does not accept any arguments

Examples

Related

Cache
CacheFilter
CacheProviders
CacheService