Package com.okta.spring.boot.sdk.cache
Class SpringCacheManager
java.lang.Object
com.okta.spring.boot.sdk.cache.SpringCacheManager
- All Implemented Interfaces:
com.okta.sdk.cache.CacheManager
,org.springframework.beans.factory.InitializingBean
public class SpringCacheManager
extends Object
implements com.okta.sdk.cache.CacheManager, org.springframework.beans.factory.InitializingBean
A Okta SDK
CacheManager
implementation that wraps a Spring
CacheManager
instance. This allows the Okta SDK to use your
existing Spring caching mechanism so you only need to configure one caching implementation.
This implementation effectively acts as an adapter or bridge from the Okta SDK cacheManager API to the Spring CacheManager API.
- Since:
- 0.3.0
-
Constructor Summary
ConstructorsConstructorDescriptionSpringCacheManager
(org.springframework.cache.CacheManager springCacheManager) Constructs a newSpringCacheManager
instance that wraps (delegates to) the specified SpringCacheManager
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
<K,
V> com.okta.sdk.cache.Cache <K, V> Consults the wrapped SpringCacheManager
instance to obtain a named SpringCache
instance.void
setSpringCacheManager
(org.springframework.cache.CacheManager cacheManager)
-
Constructor Details
-
SpringCacheManager
public SpringCacheManager() -
SpringCacheManager
public SpringCacheManager(org.springframework.cache.CacheManager springCacheManager) Constructs a newSpringCacheManager
instance that wraps (delegates to) the specified SpringCacheManager
instance.- Parameters:
springCacheManager
- the target Spring cache manager to wrap.
-
-
Method Details
-
setSpringCacheManager
public void setSpringCacheManager(org.springframework.cache.CacheManager cacheManager) -
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
getCache
Consults the wrapped SpringCacheManager
instance to obtain a named SpringCache
instance. The instance is wrapped and returned as aSpringCache
instance, which acts as a bridge/adapter over Spring's existing Cache API.- Specified by:
getCache
in interfacecom.okta.sdk.cache.CacheManager
- Type Parameters:
K
- The cache key typeV
- The cache value type- Parameters:
name
- the name of the cache to acquire.- Returns:
- the Cache with the given name
-