Package org.apache.openjpa.datacache
Interface DataCacheManager
-
- All Known Implementing Classes:
DataCacheManagerImpl
public interface DataCacheManager
Manages the system's data and query caches. You can retrieve the data cache manager from theOpenJPAConfiguration.getDataCacheManagerInstance()
.
Manages zero or more individualcaches
or partitions. Each individual partition is identified by a string-based identifier. Decides eligibility to cache for managed types.- Author:
- Abe White, Patrick Linskey, Pinaki Poddar
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close all caches.ClearableScheduler
getClearableScheduler()
Return the runnable which schedules evictions.DataCache
getDataCache(java.lang.String name)
Return the named data cache, or null if it does not exist.DataCache
getDataCache(java.lang.String name, boolean create)
Return the named data cache.CacheDistributionPolicy
getDistributionPolicy()
Return the user-specific policy that suggests the cache where a managed entity state is stored.DataCachePCDataGenerator
getPCDataGenerator()
Return the PCData generator if configured.DataCache
getSystemDataCache()
Return the system-wide data cache, or null if caching is not enabled.QueryCache
getSystemQueryCache()
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.java.util.Map<java.lang.String,java.lang.Boolean>
listKnownTypes()
Returns the names of classes that are known to the cache and whether or not they are currently being cached.DataCache
selectCache(OpenJPAStateManager sm)
Select the cache where the given managed proxy instance should be cached.void
startCaching(java.lang.String cls)
Start caching the type matching the provided class name.void
stopCaching(java.lang.String cls)
Stop caching the type matching the provided class name.
-
-
-
Method Detail
-
initialize
void initialize(OpenJPAConfiguration conf, ObjectValue dataCache, ObjectValue queryCache)
Initialize the manager, supplying the cache configuration.
-
getSystemDataCache
DataCache getSystemDataCache()
Return the system-wide data cache, or null if caching is not enabled.
-
getDataCache
DataCache getDataCache(java.lang.String name)
Return the named data cache, or null if it does not exist.
-
getDataCache
DataCache getDataCache(java.lang.String name, boolean create)
Return the named data cache. If the given name is null, the default data cache is returned.- Parameters:
create
- if true, the cache will be created if it does not already exist
-
getSystemQueryCache
QueryCache getSystemQueryCache()
Return the system query cache, or null if not configured.
-
getPCDataGenerator
DataCachePCDataGenerator getPCDataGenerator()
Return the PCData generator if configured.
-
getClearableScheduler
ClearableScheduler getClearableScheduler()
Return the runnable which schedules evictions.
-
selectCache
DataCache selectCache(OpenJPAStateManager sm)
Select the cache where the given managed proxy instance should be cached. This decision may override the cache returned bypolicy
as specified by the user.- Parameters:
sm
- the managed proxy instance- Returns:
- the cache that will store the state of the given managed instance.
- Since:
- 2.0.0
-
getDistributionPolicy
CacheDistributionPolicy getDistributionPolicy()
Return the user-specific policy that suggests the cache where a managed entity state is stored.- Since:
- 2.0.0
-
close
void close()
Close all caches.
-
stopCaching
void stopCaching(java.lang.String cls)
Stop caching the type matching the provided class name.
-
startCaching
void startCaching(java.lang.String cls)
Start caching the type matching the provided class name.
-
listKnownTypes
java.util.Map<java.lang.String,java.lang.Boolean> listKnownTypes()
Returns the names of classes that are known to the cache and whether or not they are currently being cached.
-
-