Class MemoryLimitedCacheLoader

  • All Implemented Interfaces:
    java.lang.Cloneable, BootstrapCacheLoader
    Direct Known Subclasses:
    DiskStoreBootstrapCacheLoader, TerracottaBootstrapCacheLoader

    public abstract class MemoryLimitedCacheLoader
    extends java.lang.Object
    implements BootstrapCacheLoader, java.lang.Cloneable
    Abstract class for BootstrapCacheLoader implementers that should alter their load behavior (probably stop loading) whenever the cache being bootstrapped has reached its in-memory limit (off- or on-heap)
    Author:
    Alex Snaps
    • Constructor Detail

      • MemoryLimitedCacheLoader

        public MemoryLimitedCacheLoader()
    • Method Detail

      • isInMemoryLimitReached

        protected boolean isInMemoryLimitReached​(Ehcache cache,
                                                 int loadedElements)
        Checks whether the cache has reached the limit configured for in-memory storage
        Parameters:
        cache - The cache being loaded and to be checked for limit being reached
        loadedElements - amounts of elements loaded so far
        Returns:
        true if on-heap or off-heap limit has been reached, false otherwise
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Clones the loader
        Specified by:
        clone in interface BootstrapCacheLoader
        Overrides:
        clone in class java.lang.Object
        Returns:
        clone of this instance
        Throws:
        java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface.