Package org.apache.openjpa.datacache
Interface CacheDistributionPolicy
-
- All Superinterfaces:
Configurable
- All Known Implementing Classes:
DefaultCacheDistributionPolicy,TypeBasedCacheDistributionPolicy
public interface CacheDistributionPolicy extends Configurable
A policy determines whether a given entity should be cached and if true, in which named partition of the cache.
This policy is activated for each instance if and only if the cache settings specified in metadata such as JPA specification defined@Cacheableannotation or OpenJPA specific@DataCacheannotation or configuration property such asjakarta.persistence.sharedCache.modedetermined the type of the instance being cachable.
For example, a specific policy will never be active for whenjakarta.persistence.sharedCache.modeis set toNONE.
Distribution Policies are configurable. So a specific policy can be configured as<property name="openjpa.CacheDistributionPolicy" value="com.acme.FooPolicy(param1='xyz',param2=true)"/>
wherecom.acme.FooPolicyis an implementation of this interface and defines bean style setter and getter methods for String propertyparam1and boolean propertyparam2.- Since:
- 2.0.0
- Author:
- Pinaki Poddar
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringselectCache(OpenJPAStateManager sm, Object context)Selects the name of the cache where the given managed proxy object state be cached.-
Methods inherited from interface org.apache.openjpa.lib.conf.Configurable
endConfiguration, setConfiguration, startConfiguration
-
-
-
-
Method Detail
-
selectCache
String selectCache(OpenJPAStateManager sm, Object context)
Selects the name of the cache where the given managed proxy object state be cached.- Parameters:
sm- the managed proxy object to be cached. The actual managed instance can be accessed from the proxy instance simply assm.getManagedInstance().context- the context of invocation. No specific semantics is attributed currently. Can be null.- Returns:
- name of the cache or null, implying that that the instance should not be cached.
-
-