Class LoomCacheManager
java.lang.Object
com.loomcache.springboot.cache.LoomCacheManager
- All Implemented Interfaces:
org.springframework.cache.CacheManager
public final class LoomCacheManager
extends Object
implements org.springframework.cache.CacheManager
Spring
CacheManager implementation backed by LoomCache.
Lazily creates LoomSpringCache instances on demand and caches them
locally in a ConcurrentHashMap for thread-safe access. The
eagerCacheNames list is used to pre-create caches up front so that
Spring configuration surfaced via loomcache.spring-cache.cache-names
actually takes effect at application startup instead of waiting for the
first getCache(String) call.
- Since:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLoomCacheManager(LoomCache loomClient) Convenience constructor without eager cache names.LoomCacheManager(LoomCache loomClient, List<String> eagerCacheNames) Construct a new LoomCacheManager with the supplied eager cache names propagated from Spring properties.LoomCacheManager(LoomCache loomClient, List<String> eagerCacheNames, Duration defaultTtl) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.cache.CacheMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.cache.CacheManager
resetCaches
-
Constructor Details
-
LoomCacheManager
Convenience constructor without eager cache names.- Parameters:
loomClient- the LoomCache client used for all distributed cache operations- Throws:
NullPointerException- if loomClient is null
-
LoomCacheManager
Construct a new LoomCacheManager with the supplied eager cache names propagated from Spring properties.- Parameters:
loomClient- LoomCache clienteagerCacheNames- cache names to create up front at construction time- Throws:
NullPointerException- ifloomClientoreagerCacheNamesis nullIllegalArgumentException- if any eager cache name is null or blank
-
LoomCacheManager
-
-
Method Details
-
getCache
- Specified by:
getCachein interfaceorg.springframework.cache.CacheManager
-
getCacheNames
- Specified by:
getCacheNamesin interfaceorg.springframework.cache.CacheManager
-