BoxLang Providers
CacheBox ships two BoxLang-native cache providers that bridge the CacheBox API to the BoxLang runtime's built-in cache engine. Unlike the CF or Lucee providers, these providers do not depend on an external cache store — they delegate directly to BoxLang's own caching layer, which supports multiple named cache regions.
The two implementations follow the same pattern as other dual-mode providers:
BoxLangProvider— standalone provider, implementsICacheProviderBoxLangColdBoxProvider— extendsBoxLangProviderand implementsIColdBoxProviderfor ColdBox application usage (view/event caching)
BoxLangProvider
class: coldbox.system.cache.providers.BoxLangProvider
Properties
cacheName
string
false
default
The name of the BoxLang cache region to use. Multiple providers can map to different named regions.
Configuration Example
// In your CacheBox configuration
cachebox = {
defaultCache = {
provider = "coldbox.system.cache.providers.BoxLangProvider",
properties = {
cacheName = "default"
}
},
caches = {
// A second provider pointing to a separate BoxLang cache region
sessions : {
provider : "coldbox.system.cache.providers.BoxLangProvider",
properties : { cacheName : "sessions" }
}
}
}// In your CacheBox configuration
cachebox = {
defaultCache = {
provider = "coldbox.system.cache.providers.BoxLangProvider",
properties = {
cacheName = "default"
}
},
caches = {
// A second provider pointing to a separate BoxLang cache region
sessions = {
provider = "coldbox.system.cache.providers.BoxLangProvider",
properties = { cacheName = "sessions" }
}
}
};BoxLangColdBoxProvider
class: coldbox.system.cache.providers.BoxLangColdBoxProvider
Extends BoxLangProvider and adds ColdBox-specific view and event caching support. It uses the following key prefixes when storing ColdBox-managed entries:
VIEW_CACHEKEY_PREFIX
boxlang_view-
Prefix for all view cache entries
EVENT_CACHEKEY_PREFIX
boxlang_event-
Prefix for all event cache entries
Configuration Example (ColdBox Application)
ColdBox-Specific API Methods
In addition to the standard ICacheProvider methods, BoxLangColdBoxProvider exposes the full IColdBoxProvider interface:
clearAllEvents( [boolean async=false] )
Clear all cached events
clearEvent( required string eventSnippet, [string queryString=""] )
Clear a specific cached event
clearEventMulti( required string eventsnippets, [string queryString=""] )
Clear multiple events by comma-delimited snippet list
clearView( required string viewSnippet )
Clear a specific cached view
clearViewMulti( required string viewSnippets )
Clear multiple views by comma-delimited snippet list
clearAllViews( [boolean async=false] )
Clear all cached views
Last updated
Was this helpful?