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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
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.void
initialize
(OpenJPAConfiguration conf, ObjectValue dataCache, ObjectValue queryCache) Initialize the manager, supplying the cache configuration.boolean
isCachable
(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.void
void
startCaching
(String cls) Start caching the type matching the provided class name.void
stopCaching
(String cls) Stop caching the type matching the provided class name.
-
Constructor Details
-
DataCacheManagerImpl
public DataCacheManagerImpl()
-
-
Method Details
-
initialize
Description copied from interface:DataCacheManager
Initialize the manager, supplying the cache configuration.- Specified by:
initialize
in interfaceDataCacheManager
-
getSystemDataCache
Description copied from interface:DataCacheManager
Return the system-wide data cache, or null if caching is not enabled.- Specified by:
getSystemDataCache
in interfaceDataCacheManager
-
getDataCache
Description copied from interface:DataCacheManager
Return the named data cache, or null if it does not exist.- Specified by:
getDataCache
in 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:
getDataCache
in interfaceDataCacheManager
create
- if true, the cache will be created if it does not already exist
-
getSystemQueryCache
Description copied from interface:DataCacheManager
Return the system query cache, or null if not configured.- Specified by:
getSystemQueryCache
in interfaceDataCacheManager
-
getPCDataGenerator
Description copied from interface:DataCacheManager
Return the PCData generator if configured.- Specified by:
getPCDataGenerator
in interfaceDataCacheManager
-
getClearableScheduler
Description copied from interface:DataCacheManager
Return the runnable which schedules evictions.- Specified by:
getClearableScheduler
in interfaceDataCacheManager
-
close
public void close()Description copied from interface:DataCacheManager
Close all caches.- Specified by:
close
in interfaceCloseable
- Specified by:
close
in 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:
selectCache
in 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:
getDistributionPolicy
in interfaceDataCacheManager
-
isCachable
Affirms if the given type is eligible for cache. -
setTypes
-
startCaching
Description copied from interface:DataCacheManager
Start caching the type matching the provided class name.- Specified by:
startCaching
in interfaceDataCacheManager
-
stopCaching
Description copied from interface:DataCacheManager
Stop caching the type matching the provided class name.- Specified by:
stopCaching
in interfaceDataCacheManager
-
listKnownTypes
Description copied from interface:DataCacheManager
Returns the names of classes that are known to the cache and whether or not they are currently being cached.- Specified by:
listKnownTypes
in interfaceDataCacheManager
-