public class TTLCachePolicy extends Object implements CachePolicy
DEFAULT_INITIALDELAY, DEFAULT_PERIOD, DEFAULT_SIZE, DEFAULT_SIZEOF, DEFAULT_TTI, DEFAULT_TTL
Constructor and Description |
---|
TTLCachePolicy(long ttl)
Build a policy with TTL as parameter to keep the objects alive in cache
|
TTLCachePolicy(long ttl,
long tti)
Build a policy with TTL and TTI as parameter to keep the objects alive in cache
|
TTLCachePolicy(long ttl,
long tti,
long size,
String sizeof)
Build a policy with TTL and TTI as parameter to keep the objects alive in cache
|
TTLCachePolicy(long ttl,
long tti,
TimeUnit unit)
Build a policy with TTL and TTI as parameter to keep the objects alive in cache
|
TTLCachePolicy(long ttl,
long tti,
TimeUnit unit,
long size,
String sizeof)
Build a policy with TTL and TTI as parameter to keep the objects alive in cache
|
Modifier and Type | Method and Description |
---|---|
boolean |
isAlive(long ttl)
Verify if cache is live indicating to discard the cache content.
|
boolean |
isAlive(long ttl,
long tti)
Verify if cache is live indicating to discard the cache content.
|
long |
size()
Returns the number of elements in cache.
|
long |
sizeof()
Returns the limit size of objects in cache.
|
String |
toString() |
public TTLCachePolicy(long ttl)
ttl
- time in secondspublic TTLCachePolicy(long ttl, long tti)
ttl
- time-to-live in secondstti
- time-to-idle in secondspublic TTLCachePolicy(long ttl, long tti, TimeUnit unit)
ttl
- time-to-live in secondstti
- time-to-idle in secondsunit
- time unit for TTL and TTIpublic TTLCachePolicy(long ttl, long tti, long size, String sizeof)
ttl
- time-to-live in secondstti
- time-to-idle in secondssize
- limit for number of objectsizeof
- limit for size for sum of objectspublic TTLCachePolicy(long ttl, long tti, TimeUnit unit, long size, String sizeof)
ttl
- time-to-live in secondstti
- time-to-idle in secondsunit
- time unit for TTL and TTIsize
- limit for number of objectsizeof
- limit for size for sum of objectspublic boolean isAlive(long ttl)
CachePolicy
isAlive
in interface CachePolicy
ttl
- time from object storedpublic boolean isAlive(long ttl, long tti)
CachePolicy
isAlive
in interface CachePolicy
ttl
- time-to-live from stored object in secondstti
- time-to-idle for stored store in secondspublic long size()
CachePolicy
size
in interface CachePolicy
public long sizeof()
CachePolicy
sizeof
in interface CachePolicy
Copyright © 2012–2020 jkniv, copyleft code. All rights reserved.