Class Caches

java.lang.Object
com.okta.sdk.cache.Caches

public class Caches extends Object
Static utility/helper factory methods for building CacheManagers and their associated cache regions, suitable for SINGLE-JVM APPLICATIONS.

If your application is deployed on multiple JVMs (e.g. a distributed/clustered web app), you might not want to use the builders here and instead implement the CacheManager API directly to use your distributed/clustered cache technology of choice.

See the CacheManagerBuilder JavaDoc for more information the effects of caching in single-jvm vs distributed-jvm applications.

Usage Example
 import static com.okta.sdk.cache.Caches.*;

 ...

 Caches.newCacheManager()
     .withDefaultTimeToLive(1, TimeUnit.DAYS) //general default
     .withDefaultTimeToIdle(2, TimeUnit.HOURS) //general default
     .withCache(forResource(Account.class) //Account-specific cache settings
         .withTimeToLive(1, TimeUnit.HOURS)
         .withTimeToIdle(30, TimeUnit.MINUTES))
     .withCache(forResource(Group.class) //Group-specific cache settings
         .withTimeToLive(2, TimeUnit.HOURS))

     // ... etc ...

     .build(); //build the CacheManager
 

The above TTL and TTI times are just examples showing API usage - the times themselves are not recommendations. Choose TTL and TTI times based on your application requirements.

Since:
0.5.0