Class TypeBasedCacheDistributionPolicy

  • All Implemented Interfaces:
    CacheDistributionPolicy, Configurable

    public class TypeBasedCacheDistributionPolicy
    extends DefaultCacheDistributionPolicy
    implements CacheDistributionPolicy
    A cache distribution policy based on the type of the managed objects.
    The policy is configured by specifying list of included or excluded types. The lists are specified as fully-qualified persistence class names separated by semicolon.
    The policy checks for the given instance by its type whether the class name appears in exclusion or inclusion lists. If the class name appears in exclusion list then the instance is not cached. Otherwise, if an inclusion list exists and the class name appears in inclusion list or @DataCache annotation is specified on the class meta data, then the instance is cached.
    Author:
    Pinaki Poddar
    • Constructor Detail

      • TypeBasedCacheDistributionPolicy

        public TypeBasedCacheDistributionPolicy()
    • Method Detail

      • getExcludedTypes

        public Set<String> getExcludedTypes()
        Gets the excluded types, if configured.
      • setExcludedTypes

        public void setExcludedTypes​(String types)
        Sets excluded types from a semicolon separated list of type names.
      • getIncludedTypes

        public Set<String> getIncludedTypes()
        Gets the included types, if configured.
      • setIncludedTypes

        public void setIncludedTypes​(String types)
        Sets included types from a semicolon separated list of type names.
      • selectCache

        public String selectCache​(OpenJPAStateManager sm,
                                  Object context)
        Description copied from interface: CacheDistributionPolicy
        Selects the name of the cache where the given managed proxy object state be cached.
        Specified by:
        selectCache in interface CacheDistributionPolicy
        Overrides:
        selectCache in class DefaultCacheDistributionPolicy
        Parameters:
        sm - the managed proxy object to be cached. The actual managed instance can be accessed from the proxy instance simply as sm.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.