Caches
This configures the caches in the runtime
Last updated
Was this helpful?
This configures the caches in the runtime
Last updated
Was this helpful?
BoxLang comes bundled with an enterprise caching engine that can be configured with different settings and backend object stores. It is also can give you the ability to register caches that adhere to our BoxCache interface to create an implementation agnostic API. A part from the core providers we create, we also have several in our + subscriptions and anybody can build custom providers as well.
Every BoxLang runtime comes pre-configured with the following caches that are mandatory for operation:
default
The default cache in BoxLang that's used for queries, templates, and many more internal usages.
bxSessions
If you are activating session management in your web or client applications, then here is where user session information will be stored.
bxRegex
This is where all dynamic regular expressions are compiled and kept.
Here are the available providers for BoxLang. The table shows the status of completion of each provider and it's availability for the open-source version of BoxLang, or if you are a +/++ subscriber.
BoxCacheProvider
The enterprise BoxLang cache that can leverage many different object stores.
RedisProvider
A Redis based provider
MongoProvider
A Mong DB based Provider
CouchbaseProvider
A Couchbase based provider
ElasticSearchProvider
An Elastic Search provider
Every cache must be placed inside the caches
object with a unique name key. The value of that key contains:
provider
- The name of a core provider or a full class path to use. Ex: BoxCacheProvider
which is the core one, or a module collaborated class or class path class: ortus.boxlang.modules.redis.RedisCache
properties
- An object of configuration for the provider.
Our BoxCacheProvider
is an enterprise-level cache designed to be fast and event-driven. Here are the available configuration options.
Here are the avialable object stores for our BoxCache providers. The table shows the status of completion of each provider and it's availability for the open-source version of BoxLang, or if you are a +/++ subscriber.
BlackHoleStore
Mocking store, just simulates a store, nothing is stored.
ConcurrentSoftReferenceStore
Memory-sensitive storage leveraging Java Soft References.
ConcurrentStore
Leverages concurrent hashmaps for storage.
FileSystemStore
Stores the cache items in a serialized fashion on disk
JDCBStore
Stores caches in JDBC Databases
Each store can have different configuration properties as well.
Here are the global properties for all object stores.
How many to evict at a time once a policy is triggered. The default is 1.
The eviction policy to use. The available policies are:
LRU (default)
LFU
FIFO
LIFO
RANDOM
The free memory percentage threshold to trigger eviction 0 = disabled, 1-100 = percentage of available free memory in heap. If the threadhold is reached, the eviction policy is triggered. The default is 0.
The maximum number of objects to store in the cache. The default is 1000
The maximum in seconds to keep an object in the cache since it's last access. So if an object is not accessed in this time or greater, it will be removed from the cache. The default is 1800 seconds or 30 minutes.
The maximum time in seconds to keep an object in the cache regardless if it's used or not. A default timeout of 0 = never expire, careful with this setting. The default is 3600 seconds or 60 minutes.
The object store to use to store the objects. The default is a ConcurrentStore.
reapFrequency
The frequency in seconds to check for expired objects and expire them using the policy. This creates a BoxLang task that runs every X seconds to check for expired objects. The default is 120 seconds or 2 minutes.
If enabled, the last access timeout will be reset on every access for the cache entry. This means that the last access timeout will be reset to the defaultLastAccessTimeout
on every access. Usually for session caches or to simulate a session. The default is false.
If enabled, the last access timeout will be used to evict objects from the cache. Default is true.
These are the custom properties for this store:
The absolute path of the directory that will hold all the serialized cache entries on disk.