public class DefaultJWKSetCache extends Object implements JWKSetCache
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_LIFESPAN_MINUTES
The default lifespan for cached JWK sets (5 minutes).
|
| Constructor and Description |
|---|
DefaultJWKSetCache()
Creates a new JWK set, the default lifespan of the cached JWK set is
set to 5 minutes.
|
DefaultJWKSetCache(long lifespan,
TimeUnit timeUnit)
Creates a new JWK set cache.
|
| Modifier and Type | Method and Description |
|---|---|
JWKSet |
get()
Gets the cached JWK set.
|
long |
getLifespan(TimeUnit timeUnit)
Returns the configured lifespan of the cached JWK.
|
long |
getPutTimestamp()
Returns the cache put timestamp.
|
boolean |
isExpired()
Returns
true if the cached JWK set is expired. |
void |
put(JWKSet jwkSet)
Puts the specified JWK set into the cache or clears the cache.
|
public static final long DEFAULT_LIFESPAN_MINUTES
public DefaultJWKSetCache()
public DefaultJWKSetCache(long lifespan, TimeUnit timeUnit)
lifespan - The lifespan of the cached JWK set before it
expires, negative means no expiration.timeUnit - The lifespan time unit, may be null if no
expiration.public void put(JWKSet jwkSet)
JWKSetCacheput in interface JWKSetCachejwkSet - The JWK set to cache, null to clear the cache.public JWKSet get()
JWKSetCacheget in interface JWKSetCachenull if none or expired.public long getPutTimestamp()
public boolean isExpired()
true if the cached JWK set is expired.true if expired.public long getLifespan(TimeUnit timeUnit)
timeUnit - The time unit to use.Copyright © 2019 Connect2id Ltd.. All rights reserved.