Package org.apache.openjpa.datacache
Class DataCacheManagerImpl
java.lang.Object
org.apache.openjpa.datacache.DataCacheManagerImpl
- All Implemented Interfaces:
DataCacheManager,Closeable
Default data cache manager provides handle to utilities PCDataGenerator, ClearableScheduler
and CacheDistributionPolicy for the cache operation. This implementation also determines whether a
managed type is eligible to cache.
- Author:
- Abe White, Patrick Linskey, Pinaki Poddar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close all caches.Return the runnable which schedules evictions.getDataCache(String name) Return the named data cache, or null if it does not exist.getDataCache(String name, boolean create) Returns the named cache.Gets the instance-based cache distribution policy, if configured.Return the PCData generator if configured.Return the system-wide data cache, or null if caching is not enabled.Return the system query cache, or null if not configured.voidinitialize(OpenJPAConfiguration conf, ObjectValue dataCache, ObjectValue queryCache) Initialize the manager, supplying the cache configuration.booleanisCachable(ClassMetaData meta) Affirms if the given type is eligible for cache.Returns the names of classes that are known to the cache and whether or not they are currently being cached.Select cache for the given managed instance.voidvoidstartCaching(String cls) Start caching the type matching the provided class name.voidstopCaching(String cls) Stop caching the type matching the provided class name.
-
Constructor Details
-
DataCacheManagerImpl
public DataCacheManagerImpl()
-
-
Method Details
-
initialize
Description copied from interface:DataCacheManagerInitialize the manager, supplying the cache configuration.- Specified by:
initializein interfaceDataCacheManager
-
getSystemDataCache
Description copied from interface:DataCacheManagerReturn the system-wide data cache, or null if caching is not enabled.- Specified by:
getSystemDataCachein interfaceDataCacheManager
-
getDataCache
Description copied from interface:DataCacheManagerReturn the named data cache, or null if it does not exist.- Specified by:
getDataCachein interfaceDataCacheManager
-
getDataCache
Returns the named cache. If the given name is name or the name of the cache plugin then returns the main cache. Otherwise, delegates to the main cache to obtain a partition.- Specified by:
getDataCachein interfaceDataCacheManagercreate- if true, the cache will be created if it does not already exist
-
getSystemQueryCache
Description copied from interface:DataCacheManagerReturn the system query cache, or null if not configured.- Specified by:
getSystemQueryCachein interfaceDataCacheManager
-
getPCDataGenerator
Description copied from interface:DataCacheManagerReturn the PCData generator if configured.- Specified by:
getPCDataGeneratorin interfaceDataCacheManager
-
getClearableScheduler
Description copied from interface:DataCacheManagerReturn the runnable which schedules evictions.- Specified by:
getClearableSchedulerin interfaceDataCacheManager
-
close
public void close()Description copied from interface:DataCacheManagerClose all caches.- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceDataCacheManager
-
selectCache
Select cache for the given managed instance. If type based verification affirms the type to be cached then the instance based policy is called to determine the target cache.- Specified by:
selectCachein interfaceDataCacheManager- Parameters:
sm- the managed proxy instance- Returns:
- the cache that will store the state of the given managed instance.
-
getDistributionPolicy
Gets the instance-based cache distribution policy, if configured.- Specified by:
getDistributionPolicyin interfaceDataCacheManager
-
isCachable
Affirms if the given type is eligible for cache. -
setTypes
-
startCaching
Description copied from interface:DataCacheManagerStart caching the type matching the provided class name.- Specified by:
startCachingin interfaceDataCacheManager
-
stopCaching
Description copied from interface:DataCacheManagerStop caching the type matching the provided class name.- Specified by:
stopCachingin interfaceDataCacheManager
-
listKnownTypes
Description copied from interface:DataCacheManagerReturns the names of classes that are known to the cache and whether or not they are currently being cached.- Specified by:
listKnownTypesin interfaceDataCacheManager
-