ehcache

net.sf.ehcache.store
Class MemoryLimitedCacheLoader

java.lang.Object
  extended by net.sf.ehcache.store.MemoryLimitedCacheLoader
All Implemented Interfaces:
Cloneable, BootstrapCacheLoader
Direct Known Subclasses:
DiskStoreBootstrapCacheLoader, TerracottaBootstrapCacheLoader

public abstract class MemoryLimitedCacheLoader
extends Object
implements BootstrapCacheLoader, 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 Summary
MemoryLimitedCacheLoader()
           
 
Method Summary
 Object clone()
          Clones the loader
protected  boolean isInMemoryLimitReached(Ehcache cache, int loadedElements)
          Checks whether the cache has reached the limit configured for in-memory storage
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.ehcache.bootstrap.BootstrapCacheLoader
isAsynchronous, load
 

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 Object clone()
             throws CloneNotSupportedException
Clones the loader

Specified by:
clone in interface BootstrapCacheLoader
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

ehcache

Copyright 2001-2015, Terracotta, Inc.