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 CacheServiceCache Serviceprotected CacheConfigThe cache configurationprotected AtomicBooleanAtomic Boolean if the cache provider is enabledprotected InterceptorPoolInterceptor Local Poolprotected KeyThe name of the cache providerprotected booleanReporting enabled bitprotected ICacheStatsThe ICacheStats object for this cache providerstatic final Class<ObjectStoreType> -------------------------------------------------------------------------- Public Properties -------------------------------------------------------------------------- -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAnnounce an event with the providedIStructof data.protected voidAnnounce an event in the Runtime and the local pool with the providedIStructof data.protected static IObjectStorebuildObjectStore(CacheConfig config) Build out the object store according to the configurationprotected static IObjectStorebuildObjectStoreByClass(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 ExecutorRecordGet a referece to the CacheService Task SchedulergetType()Get the provider typebooleanIs it enabledbooleanIs reporting enabledprotected booleanJVM 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, waitMethods 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:
getCacheServicein interfaceICacheProvider- Returns:
- The cache service
-
getStats
Get the cache stats- Specified by:
getStatsin interfaceICacheProvider
-
getInterceptorPool
Get the interceptor pool for this cache- Specified by:
getInterceptorPoolin interfaceICacheProvider
-
clearStats
Clear The stats- Specified by:
clearStatsin interfaceICacheProvider- Returns:
- The cache provider
-
getName
Get the name of the cache provider- Specified by:
getNamein 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:
setNamein interfaceICacheProvider- Parameters:
name- The name of the cache provider- Returns:
- The cache provider
-
getType
Get the provider type- Specified by:
getTypein interfaceICacheProvider- Returns:
- The provider type
-
getConfig
Get the cache configuration- Specified by:
getConfigin interfaceICacheProvider- Returns:
- The cache configuration
-
isEnabled
public boolean isEnabled()Is it enabled- Specified by:
isEnabledin interfaceICacheProvider
-
isReportingEnabled
public boolean isReportingEnabled()Is reporting enabled- Specified by:
isReportingEnabledin interfaceICacheProvider
-
getCachedObjectMetadata
Get a cache objects metadata about its performance. This value is a structure of name-value pairs of metadata.- Specified by:
getCachedObjectMetadatain 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:
configurein 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:
getAsyncin 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 providedIStructof data.- Parameters:
event- The event to announcedata- The data to announce
-
announce
Announce an event with the providedIStructof 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
-