
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 serializationTimeoutExceptionCacheException<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 valueTimeoutExceptionCacheExceptionboolean delete(String key) throws TimeoutException, CacheException
key - the keyTimeoutExceptionCacheExceptionvoid delete(Collection<String> keys) throws TimeoutException, CacheException
keys - TimeoutExceptionCacheExceptionvoid flush()
throws TimeoutException,
CacheException
TimeoutExceptionCacheException<T> T get(String key, SerializationType serializationType) throws TimeoutException, CacheException
T - key - the keyserializationType - the type of serialization to useTimeoutExceptionCacheExceptionMap<String,Object> getBulk(Collection<String> keys, SerializationType serializationType) throws TimeoutException, CacheException
TimeoutExceptionCacheExceptionlong incr(String key, int by, long def) throws TimeoutException, CacheException
key - the keyby - increment valuedef - initial valueTimeoutExceptionCacheExceptionlong 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 specificationTimeoutExceptionCacheException<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 useTimeoutExceptionCacheException<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 useTimeoutExceptionCacheExceptionLong getCounter(String key) throws TimeoutException, CacheException
key - CacheExceptionTimeoutExceptionvoid setCounter(String key, int expiration, long value) throws TimeoutException, CacheException
key - the keyexpiration - expiration time in seconds as defined in memcached specificationvalue - the valueCacheExceptionTimeoutExceptionvoid shutdown()
Object getNativeClient()
Copyright © 2019. All rights reserved.