Class CacheExpiry
-
- All Implemented Interfaces:
public class CacheExpiryRepresents the expiry of a cached item.
-
-
Field Summary
Fields Modifier and Type Field Description public final Dateexpiration
-
Method Summary
Modifier and Type Method Description final DategetExpiration()static CacheExpiryafter(long durationInMillis)Creates a CacheExpirywithCacheExpiry.expirationafterdurationInMillisfrom now.static CacheExpiryat(Date date)Creates a CacheExpirywithexpirationat the date provided.static CacheExpirynever()Creates a CacheExpirywith noexpirationdate.booleanisExpired()Evaluates whether the CacheExpiry.expirationhas elapsed.-
-
Method Detail
-
getExpiration
final Date getExpiration()
-
after
static CacheExpiry after(long durationInMillis)
Creates a
CacheExpirywithCacheExpiry.expirationafterdurationInMillisfrom now.- Parameters:
durationInMillis- the milliseconds after current time that theexpirationshould be set to- Returns:
CacheExpirywithexpirationafterdurationInMillisfrom now.
-
at
static CacheExpiry at(Date date)
Creates a
CacheExpirywithexpirationat the date provided.- Parameters:
date- that that theCacheExpiry.expirationshould be set to- Returns:
CacheExpirywithexpirationat the date provided.
-
never
static CacheExpiry never()
Creates a
CacheExpirywith noexpirationdate.- Returns:
CacheExpirywith noexpiration.
-
isExpired
boolean isExpired()
Evaluates whether the
CacheExpiry.expirationhas elapsed.- Returns:
true if the
CacheExpiry.expirationis before current time.
-
-
-
-