public interface Cache
Modifier and Type | Method and Description |
---|---|
<T> boolean |
add(String key,
int expiration,
Object value,
SerializationType serializationType)
Add object to cache if it doesn't exist.
|
<T> boolean |
addSilently(String key,
int expiration,
Object value,
SerializationType serializationType)
Add object to cache if it doesn't exist.
|
long |
decr(String key,
int by)
Decrement counter in cache by given value.
|
void |
delete(Collection<String> keys)
Deletes values under given keys.
|
boolean |
delete(String key)
Deletes value under given key.
|
void |
flush()
Flushes all data.
|
<T> T |
get(String key,
SerializationType serializationType)
Get value by key.
|
Collection<String> |
getAliases()
Gets optional cache's aliases.
|
Collection<SocketAddress> |
getAvailableServers()
Gets available cache servers.
|
Map<String,Object> |
getBulk(Collection<String> keys,
SerializationType serializationType) |
Long |
getCounter(String key)
Gets counter from cache without incrementing.
|
String |
getName()
Gets name of the cache.
|
Object |
getNativeClient()
Expose native memcached client.
|
CacheProperties |
getProperties() |
long |
incr(String key,
int by,
long def)
Increments counter in cache by given value.
|
long |
incr(String key,
int by,
long def,
int expiration)
Increments counter in cache by given value.
|
boolean |
isEnabled() |
<T> void |
set(String key,
int expiration,
Object value,
SerializationType serializationType)
Store key-value item to memcached.
|
void |
setCounter(String key,
int expiration,
long value)
Sets initial value of counter.
|
<T> void |
setSilently(String key,
int expiration,
Object value,
SerializationType serializationType)
Store key-value item to memcached.
|
void |
shutdown()
Shutdowns cache.
|
Collection<SocketAddress> getAvailableServers()
String getName()
Collection<String> getAliases()
CacheProperties getProperties()
boolean isEnabled()
<T> boolean add(String key, int expiration, Object value, SerializationType serializationType) throws TimeoutException, CacheException
key
- the keyexpiration
- expiration time in seconds as defined in memcached specificationvalue
- the value to addserializationType
- type of serializationTimeoutException
CacheException
<T> boolean addSilently(String key, int expiration, Object value, SerializationType serializationType)
key
- the cache keyexpiration
- the expiration time in seconds as defined in memcached specificationvalue
- the value to addserializationType
- the type of serializationlong decr(String key, int by) throws TimeoutException, CacheException
key
- the keyby
- decrement valueTimeoutException
CacheException
boolean delete(String key) throws TimeoutException, CacheException
key
- the keyTimeoutException
CacheException
void delete(Collection<String> keys) throws TimeoutException, CacheException
keys
- TimeoutException
CacheException
void flush() throws TimeoutException, CacheException
TimeoutException
CacheException
<T> T get(String key, SerializationType serializationType) throws TimeoutException, CacheException
T
- key
- the keyserializationType
- the type of serialization to useTimeoutException
CacheException
Map<String,Object> getBulk(Collection<String> keys, SerializationType serializationType) throws TimeoutException, CacheException
TimeoutException
CacheException
long incr(String key, int by, long def) throws TimeoutException, CacheException
key
- the keyby
- increment valuedef
- initial valueTimeoutException
CacheException
long incr(String key, int by, long def, int expiration) throws TimeoutException, CacheException
key
- the keyby
- increment valuedef
- initial valueexpiration
- expiration time in seconds as defined in memcached specificationTimeoutException
CacheException
<T> void set(String key, int expiration, Object value, SerializationType serializationType) throws TimeoutException, CacheException
T
- key
- stored keyexpiration
- expiration time in seconds as defined in memcached specificationvalue
- stored dataserializationType
- the type of serialization to useTimeoutException
CacheException
<T> void setSilently(String key, int expiration, Object value, SerializationType serializationType)
T
- key
- stored keyexpiration
- expiration time in seconds as defined in memcached specificationvalue
- stored dataserializationType
- the type of serialization to useTimeoutException
CacheException
Long getCounter(String key) throws TimeoutException, CacheException
key
- CacheException
TimeoutException
void setCounter(String key, int expiration, long value) throws TimeoutException, CacheException
key
- the keyexpiration
- expiration time in seconds as defined in memcached specificationvalue
- the valueCacheException
TimeoutException
void shutdown()
Object getNativeClient()
Copyright © 2019. All rights reserved.