Class DataCacheManagerImpl

  • All Implemented Interfaces:
    DataCacheManager, org.apache.openjpa.lib.util.Closeable

    public class DataCacheManagerImpl
    extends java.lang.Object
    implements org.apache.openjpa.lib.util.Closeable, DataCacheManager
    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 Detail

      • DataCacheManagerImpl

        public DataCacheManagerImpl()
    • Method Detail

      • initialize

        public void initialize​(OpenJPAConfiguration conf,
                               org.apache.openjpa.lib.conf.ObjectValue dataCache,
                               org.apache.openjpa.lib.conf.ObjectValue queryCache)
        Description copied from interface: DataCacheManager
        Initialize the manager, supplying the cache configuration.
        Specified by:
        initialize in interface DataCacheManager
      • getDataCache

        public DataCache getDataCache​(java.lang.String name,
                                      boolean create)
        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 interface DataCacheManager
        create - if true, the cache will be created if it does not already exist
      • close

        public void close()
        Description copied from interface: DataCacheManager
        Close all caches.
        Specified by:
        close in interface org.apache.openjpa.lib.util.Closeable
        Specified by:
        close in interface DataCacheManager
      • selectCache

        public DataCache selectCache​(OpenJPAStateManager sm)
        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 interface DataCacheManager
        Parameters:
        sm - the managed proxy instance
        Returns:
        the cache that will store the state of the given managed instance.
      • isCachable

        public boolean isCachable​(ClassMetaData meta)
        Affirms if the given type is eligible for cache.
      • setTypes

        public void setTypes​(java.util.Set<java.lang.String> includedTypes,
                             java.util.Set<java.lang.String> excludedTypes)
      • startCaching

        public void startCaching​(java.lang.String cls)
        Description copied from interface: DataCacheManager
        Start caching the type matching the provided class name.
        Specified by:
        startCaching in interface DataCacheManager
      • stopCaching

        public void stopCaching​(java.lang.String cls)
        Description copied from interface: DataCacheManager
        Stop caching the type matching the provided class name.
        Specified by:
        stopCaching in interface DataCacheManager
      • listKnownTypes

        public java.util.Map<java.lang.String,​java.lang.Boolean> 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 interface DataCacheManager