Class MemoryConstrainedCacheManager

  extended by org.apache.shiro.cache.AbstractCacheManager
      extended by org.apache.shiro.cache.MemoryConstrainedCacheManager
All Implemented Interfaces:
CacheManager, Destroyable

public class MemoryConstrainedCacheManager
extends AbstractCacheManager

Simple memory-only based CacheManager implementation usable in production environments. It will not cause memory leaks as it produces Caches backed by SoftHashMaps which auto-size themselves based on the runtime environment's memory limitations and garbage collection behavior.

While the Cache instances created are thread-safe, they do not offer any enterprise-level features such as cache coherency, optimistic locking, failover or other similar features. For more enterprise features, consider using a different CacheManager implementation backed by an enterprise-grade caching product (EhCache, TerraCotta, Coherence, GigaSpaces, etc, etc).


Constructor Summary
Method Summary
protected  Cache createCache(String name)
          Returns a new MapCache instance backed by a SoftHashMap.
Methods inherited from class org.apache.shiro.cache.AbstractCacheManager
destroy, getCache, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public MemoryConstrainedCacheManager()
Method Detail


protected Cache createCache(String name)
Returns a new MapCache instance backed by a SoftHashMap.

Specified by:
createCache in class AbstractCacheManager
name - the name of the cache
a new MapCache instance backed by a SoftHashMap.

Copyright © 2004-2014 The Apache Software Foundation. All Rights Reserved.