public class DirectCache extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(Object key,
byte[] value,
int expiry)
Put an element in the store only if no element is currently mapped to the elements key.
|
<T> boolean |
add(Object key,
T value,
ValueSerializer<T> serializer)
Put an element in the store only if no element is currently mapped to the elements key.
|
<T> boolean |
add(Object key,
T value,
ValueSerializer<T> serializer,
int expiry)
Put an element in the store only if no element is currently mapped to the elements key.
|
void |
destroy()
destroy cache, dispose all resources.
|
boolean |
exists(Object key)
to see weather the key exists or not.if the entry is expired still return true.
|
byte[] |
get(Object key)
retrieve node by key from cache.
|
<T> T |
get(Object key,
ValueSerializer<T> serializer)
retrieve node by key from cache.
|
Collection<Object> |
keys()
return all keys cached.
|
static DirectCacheBuilder |
newBuilder() |
long |
offHeapSize()
return the actualUsed off-heap memory in bytes.
|
void |
remove(Object key)
remove key from cache
|
void |
set(Object key,
byte[] value)
set a value.if already exist, replace it
|
void |
set(Object key,
byte[] value,
int expiry)
set a value. if already exist, replace it
|
<T> void |
set(Object key,
T value,
ValueSerializer<T> serializer)
set a value.if already exist, replace it
|
<T> void |
set(Object key,
T value,
ValueSerializer<T> serializer,
int expiry)
set a value. if already exist, replace it
|
long |
size()
the num of cache entries.
|
public static DirectCacheBuilder newBuilder()
public <T> T get(Object key, ValueSerializer<T> serializer)
public byte[] get(Object key)
public <T> void set(Object key, T value, ValueSerializer<T> serializer)
value - cannot be nullpublic <T> void set(Object key, T value, ValueSerializer<T> serializer, int expiry)
expiry - The amount of time for the element to live, in seconds.value - cannot be nullpublic void set(Object key, byte[] value)
value - cannot be nullpublic void set(Object key, byte[] value, int expiry)
expiry - The amount of time for the element to live, in seconds.value - cannot be nullpublic <T> boolean add(Object key, T value, ValueSerializer<T> serializer)
public <T> boolean add(Object key, T value, ValueSerializer<T> serializer, int expiry)
expiry - The amount of time for the element to live, in seconds.public boolean add(Object key, byte[] value, int expiry)
expiry - The amount of time for the element to live, in seconds.public boolean exists(Object key)
public Collection<Object> keys()
public void destroy()
public long size()
public void remove(Object key)
public long offHeapSize()
Copyright © 2014. All rights reserved.