Class DefaultCacheManager

java.lang.Object
com.okta.sdk.impl.cache.DefaultCacheManager
All Implemented Interfaces:
CacheManager

public class DefaultCacheManager extends Object implements CacheManager
Very simple default CacheManager implementation that retains all created Cache instances in an in-memory ConcurrentMap. By default, this implementation creates thread-safe DefaultCache instances via the createCache(name) method, but this can be overridden by subclasses that wish to provide different Cache implementations.

Clustering

This implementation DOES NOT SUPPORT CLUSTERING.

If your application is deployed on multiple hosts, it is strongly recommended that you configure the Okta SDK with a clustered CacheManager implementation so all of your application instances can utilize the same cache policy and see the same security/identity data. Some example clusterable caching projects: Hazelcast, Ehcache+Terracotta, Coherence, GigaSpaces, etc.

This implementation is production-quality, but only recommended for single-node/single-JVM applications.

Time To Idle

Time to Idle is the amount of time a cache entry may be idle - unused (not accessed) - before it will expire and no longer be available. If a cache entry is not accessed at all after this amount of time, it will be removed from the cache as soon as possible.

This implementation's defaultTimeToIdle is null, which means that cache entries can potentially remain idle indefinitely. Note however that a cache entry can still be expunged due to other conditions (e.g. memory constraints, Time to Live setting, etc).

The defaultTimeToIdle setting is only applied to newly created Cache instances. It does not affect already existing Caches.

Time to Live

Time to Live is the amount of time a cache entry may exist after first being created before it will expire and no longer be available. If a cache entry ever becomes older than this amount of time (regardless of how often it is accessed), it will be removed from the cache as soon as possible.

This implementation's defaultTimeToLive is null, which means that cache entries could potentially live indefinitely. Note however that a cache entry can still be expunged due to other conditions (e.g. memory constraints, Time to Idle setting, etc).

The defaultTimeToLive setting is only applied to newly created Cache instances. It does not affect already existing Caches.

Thread Safety

This implementation and the cache instances it creates are thread-safe and usable in concurrent environments.
Since:
0.5.0
See Also: