Package org.apache.shiro.cache
Class MemoryConstrainedCacheManager
- java.lang.Object
-
- org.apache.shiro.cache.AbstractCacheManager
-
- org.apache.shiro.cache.MemoryConstrainedCacheManager
-
- All Implemented Interfaces:
CacheManager,org.apache.shiro.util.Destroyable
public class MemoryConstrainedCacheManager extends AbstractCacheManager
Simple memory-only basedCacheManagerimplementation usable in production environments. It will not cause memory leaks as it producesCaches backed bySoftHashMaps which auto-size themselves based on the runtime environment's memory limitations and garbage collection behavior. While theCacheinstances 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 differentCacheManagerimplementation backed by an enterprise-grade caching product (Hazelcast, EhCache, TerraCotta, Coherence, GigaSpaces, etc, etc).- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description MemoryConstrainedCacheManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CachecreateCache(String name)Returns a newMapCacheinstance backed by aSoftHashMap.-
Methods inherited from class org.apache.shiro.cache.AbstractCacheManager
destroy, getCache, toString
-
-
-
-
Method Detail
-
createCache
protected Cache createCache(String name)
Returns a newMapCacheinstance backed by aSoftHashMap.- Specified by:
createCachein classAbstractCacheManager- Parameters:
name- the name of the cache- Returns:
- a new
MapCacheinstance backed by aSoftHashMap.
-
-