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 newSpringCacheManagerinstance that wraps (delegates to) the specified SpringCacheManagerinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoid<K,V> com.okta.sdk.cache.Cache <K, V> Consults the wrapped SpringCacheManagerinstance to obtain a named SpringCacheinstance.voidsetSpringCacheManager(org.springframework.cache.CacheManager cacheManager)
-
Constructor Details
-
SpringCacheManager
public SpringCacheManager() -
SpringCacheManager
public SpringCacheManager(org.springframework.cache.CacheManager springCacheManager) Constructs a newSpringCacheManagerinstance that wraps (delegates to) the specified SpringCacheManagerinstance.- Parameters:
springCacheManager- the target Spring cache manager to wrap.
-
-
Method Details
-
setSpringCacheManager
public void setSpringCacheManager(org.springframework.cache.CacheManager cacheManager) -
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getCache
Consults the wrapped SpringCacheManagerinstance to obtain a named SpringCacheinstance. The instance is wrapped and returned as aSpringCacheinstance, which acts as a bridge/adapter over Spring's existing Cache API.- Specified by:
getCachein 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
-