Constructor and Description |
---|
DefaultCacheImpl()
Initializes the cache with auto expiration OFF.
|
DefaultCacheImpl(long autoExpireTimeInMs)
Initialize the cache with auto expiration ON.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the entire cache.
|
Object |
get(Object key)
Returns the cached value corresponding to key.
|
long |
getAutoExpireTimeInMs() |
long |
getLastUpateTime(Object key)
Returns the last update time in milliseconds since January 1, 1970, 00:00:00 GMT for the cached entry.
|
void |
put(Object key,
Object value)
Puts the key-value pair in the cache.
|
void |
remove(Object key)
Removes the entry from the cache.
|
void |
setAutoExpireTimeInMs(long autoExpireTimeInMs)
Set the auto expiry time, after which an entry will expire after it is put in cache.
|
public DefaultCacheImpl()
public DefaultCacheImpl(long autoExpireTimeInMs)
autoExpireTimeInMs
- Time in milliseconds after which entries in cache expirepublic void clear()
Cache
public Object get(Object key)
Cache
public void put(Object key, Object value)
Cache
Cache.getAutoExpireTimeInMs()
milliseconds.public void remove(Object key)
Cache
public long getLastUpateTime(Object key)
Cache
getLastUpateTime
in interface Cache
key
- The key for which last update time is requiredpublic long getAutoExpireTimeInMs()
getAutoExpireTimeInMs
in interface Cache
public void setAutoExpireTimeInMs(long autoExpireTimeInMs)
Cache
setAutoExpireTimeInMs
in interface Cache
autoExpireTimeInMs
- The auto expiry time in millisecondsCopyright © 2010–2014 Arcbees. All rights reserved.