public interface CacheItem
| Modifier and Type | Field and Description |
|---|---|
static String |
CHARSET_UTF8 |
static String |
DEFAULT_CHARSET |
| Modifier and Type | Method and Description |
|---|---|
default void |
expireAfter(java.time.Duration duration)
Sets period of time which items will be expired
|
default void |
expireAfter(Long duration)
Sets period of time which items will be expired
|
Long |
getExpiration()
Returns time which item will be expired
|
String |
getKey()
Returns key of item
|
Object |
getValue()
Returns value of item
|
default <T> T |
getValue(Class<T> className)
Get value as an instance
|
static CacheItem |
newInstance(String key)
Creates and returns a new instance of CacheItem with key
|
static CacheItem |
newInstance(String key,
Object value)
Creates and returns a new instance of CacheItem with key
|
static CacheItem |
newInstance(String key,
Object value,
Long expiration)
Creates and returns a new instance of CacheItem with key
|
void |
setExpiration(Long expiration)
Sets time which item will be expired
|
void |
setKey(String key)
Sets key of item
|
void |
setValue(Object value)
Sets value of item
|
static final String CHARSET_UTF8
static final String DEFAULT_CHARSET
String getKey()
void setKey(String key)
key - a string represents for keyObject getValue()
default <T> T getValue(Class<T> className)
T - object type to returnclassName - a string represents for class's nameUnsupportedClassException - if value cannot convert to proposed classvoid setValue(Object value)
value - an object represents for item's valueLong getExpiration()
void setExpiration(Long expiration)
expiration - a long value represents for expiration timedefault void expireAfter(Long duration)
duration - a long value represents for period time (in milliseconds)default void expireAfter(java.time.Duration duration)
duration - a Duration object represents for period timeDurationstatic CacheItem newInstance(String key)
key - a string represents for cache's keystatic CacheItem newInstance(String key, Object value)
key - a string represents for cache's keyvalue - an object represents of valuestatic CacheItem newInstance(String key, Object value, Long expiration)
key - a string represents for cache's keyvalue - an object represents of valueexpiration - a Long value represents of expirationCopyright © 2018. All rights reserved.