Class AbstractCacheProvider
java.lang.Object
ortus.boxlang.runtime.cache.providers.AbstractCacheProvider
- All Implemented Interfaces:
ICacheProvider
- Direct Known Subclasses:
BoxCacheProvider
Abstract Cache Provider for BoxLang
This is an optional base class for all cache providers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CacheService
Cache Serviceprotected CacheConfig
The cache configurationprotected AtomicBoolean
Atomic Boolean if the cache provider is enabledprotected InterceptorPool
Interceptor Local Poolprotected Key
The name of the cache providerprotected boolean
Reporting enabled bitprotected ICacheStats
The ICacheStats object for this cache providerstatic final Class
<ObjectStoreType> -------------------------------------------------------------------------- Public Properties -------------------------------------------------------------------------- -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Announce an event with the providedIStruct
of data.protected void
Announce an event in the Runtime and the local pool with the providedIStruct
of data.protected static IObjectStore
buildObjectStore
(CacheConfig config) Build out the object store according to the configurationprotected static IObjectStore
buildObjectStoreByClass
(String storeClasspath) Build the object store by class pathClear The statsconfigure
(CacheService cacheService, CacheConfig config) Configure the cache provider for operationGet an object from the store with metadata tracking using a CompletableFuturegetCachedObjectMetadata
(String... key) Get a cache objects metadata about its performance.Get the cache service that is using this providerGet the cache configurationGet the interceptor pool for this cachegetName()
Get the name of the cache providergetStats()
Get the cache statsprotected ExecutorRecord
Get a referece to the CacheService Task SchedulergetType()
Get the provider typeboolean
Is it enabledboolean
Is reporting enabledprotected boolean
JVM Threshold checksSet the name of the cache providerSet the name of the cache providerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ortus.boxlang.runtime.cache.providers.ICacheProvider
clear, clear, clearAll, clearAll, clearQuiet, get, get, get, getCachedObjectMetadata, getKeys, getKeys, getKeysStream, getKeysStream, getObjectStore, getOrSet, getOrSet, getOrSet, getOrSet, getQuiet, getSize, getStoreMetadataKeyMap, getStoreMetadataReport, getStoreMetadataReport, lookup, lookup, lookup, lookupQuiet, reap, set, set, set, set, set, set, setQuiet, shutdown
-
Field Details
-
TYPES
-------------------------------------------------------------------------- Public Properties -------------------------------------------------------------------------- -
name
The name of the cache provider -
enabled
Atomic Boolean if the cache provider is enabled -
reportingEnabled
protected boolean reportingEnabledReporting enabled bit -
stats
The ICacheStats object for this cache provider -
config
The cache configuration -
cacheService
Cache Service -
interceptorPool
Interceptor Local Pool
-
-
Constructor Details
-
AbstractCacheProvider
public AbstractCacheProvider()
-
-
Method Details
-
getCacheService
Get the cache service that is using this provider- Specified by:
getCacheService
in interfaceICacheProvider
- Returns:
- The cache service
-
getStats
Get the cache stats- Specified by:
getStats
in interfaceICacheProvider
-
getInterceptorPool
Get the interceptor pool for this cache- Specified by:
getInterceptorPool
in interfaceICacheProvider
-
clearStats
Clear The stats- Specified by:
clearStats
in interfaceICacheProvider
- Returns:
- The cache provider
-
getName
Get the name of the cache provider- Specified by:
getName
in interfaceICacheProvider
-
setName
Set the name of the cache provider- Parameters:
name
- The name of the cache provider- Returns:
- The cache provider
-
setName
Set the name of the cache provider- Specified by:
setName
in interfaceICacheProvider
- Parameters:
name
- The name of the cache provider- Returns:
- The cache provider
-
getType
Get the provider type- Specified by:
getType
in interfaceICacheProvider
- Returns:
- The provider type
-
getConfig
Get the cache configuration- Specified by:
getConfig
in interfaceICacheProvider
- Returns:
- The cache configuration
-
isEnabled
public boolean isEnabled()Is it enabled- Specified by:
isEnabled
in interfaceICacheProvider
-
isReportingEnabled
public boolean isReportingEnabled()Is reporting enabled- Specified by:
isReportingEnabled
in interfaceICacheProvider
-
getCachedObjectMetadata
Get a cache objects metadata about its performance. This value is a structure of name-value pairs of metadata.- Specified by:
getCachedObjectMetadata
in interfaceICacheProvider
- Parameters:
key
- A varargs of keys of the object- Returns:
- The metadata structure of structures
-
configure
Configure the cache provider for operation- Specified by:
configure
in interfaceICacheProvider
- Parameters:
cacheService
- The cache service that is configuring the cache providerconfig
- The configuration object- Returns:
- The cache provider
-
getAsync
Get an object from the store with metadata tracking using a CompletableFuture- Specified by:
getAsync
in interfaceICacheProvider
- Parameters:
key
- The key to retrieve- Returns:
- CompletableFuture of the value retrieved or null
-
getTaskScheduler
Get a referece to the CacheService Task Scheduler- Returns:
- The task scheduler
-
memoryThresholdCheck
protected boolean memoryThresholdCheck()JVM Threshold checks -
announce
Announce an event in the Runtime and the local pool with the providedIStruct
of data.- Parameters:
event
- The event to announcedata
- The data to announce
-
announce
Announce an event with the providedIStruct
of data.- Parameters:
state
- The state key to announcedata
- The data to announce
-
buildObjectStore
Build out the object store according to the configuration- Parameters:
config
- The configuration- Returns:
- The object store created and configured
-
buildObjectStoreByClass
Build the object store by class path- Parameters:
storeClasspath
- The class path of the object store- Returns:
- The object store
- Throws:
BoxRuntimeException
- If the object store cannot be loadedBoxRuntimeException
- If the object store does not implement IObjectStoreBoxRuntimeException
- If the object store cannot be instantiated
-