public class ExpiringInMemoryObjectCache extends Object implements ObjectCache
| Modifier and Type | Class and Description |
|---|---|
static class |
ExpiringInMemoryObjectCache.Builder
Builder object.
|
| Constructor and Description |
|---|
ExpiringInMemoryObjectCache(ExpiringInMemoryObjectCache.Builder builder)
Creates new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the cache, all objects are removed.
|
static ExpiringInMemoryObjectCache |
create(int expireTimeout,
boolean renewOnGet)
Creates new instance.
|
Object |
get(String key)
Retrieves object.
|
Object |
get(String key,
Object def)
Returns object in the non strict manner.
|
Set<String> |
getKeys()
Returns all keys which are in use.
|
void |
put(String key,
Object object)
Puts object into cache.
|
void |
remove(String key)
Removes the specified key.
|
String |
toString() |
public ExpiringInMemoryObjectCache(ExpiringInMemoryObjectCache.Builder builder)
builder - builder objectpublic void put(String key, Object object)
ObjectCacheput in interface ObjectCachekey - data keyobject - objectpublic void remove(String key)
ObjectCacheremove in interface ObjectCachekey - keypublic Object get(String key)
ObjectCacheget in interface ObjectCachekey - data keypublic Object get(String key, Object def)
ObjectCacheget in interface ObjectCachekey - keydef - default value returned if key doesn't existspublic Set<String> getKeys()
ObjectCachegetKeys in interface ObjectCachepublic void clear()
ObjectCacheclear in interface ObjectCachepublic static ExpiringInMemoryObjectCache create(int expireTimeout, boolean renewOnGet)
expireTimeout - timeout for object expiration, in millisecondsrenewOnGet - whether timeout should be renewed on getCopyright © 2016. All rights reserved.