Constructor and Description |
---|
PrefixedCacheImpl(Cache cache,
String requestedName,
String namePrefixSeparator) |
Modifier and Type | Method and Description |
---|---|
<T> boolean |
add(String key,
int exp,
Object value,
SerializationType serializationType)
Add object to cache if it doesn't exist.
|
<T> boolean |
addSilently(String cacheKey,
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 cacheKey)
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 exp)
Increments counter in cache by given value.
|
boolean |
isEnabled() |
<T> void |
set(String key,
int exp,
Object value,
SerializationType serializationType)
Store key-value item to memcached.
|
void |
setCounter(String cacheKey,
int expiration,
long value)
Sets initial value of counter.
|
<T> void |
setSilently(String cacheKey,
int expiration,
Object value,
SerializationType serializationType)
Store key-value item to memcached.
|
void |
shutdown()
Shutdowns cache.
|
public Collection<SocketAddress> getAvailableServers()
Cache
getAvailableServers
in interface Cache
public Collection<String> getAliases()
Cache
getAliases
in interface Cache
public CacheProperties getProperties()
getProperties
in interface Cache
public <T> boolean add(String key, int exp, Object value, SerializationType serializationType) throws TimeoutException, CacheException
Cache
add
in interface Cache
key
- the keyexp
- expiration time in seconds as defined in memcached specificationvalue
- the value to addserializationType
- type of serializationTimeoutException
CacheException
public <T> boolean addSilently(String cacheKey, int expiration, Object value, SerializationType serializationType)
Cache
addSilently
in interface Cache
cacheKey
- the cache keyexpiration
- the expiration time in seconds as defined in memcached specificationvalue
- the value to addserializationType
- the type of serializationpublic long decr(String key, int by) throws TimeoutException, CacheException
Cache
decr
in interface Cache
key
- the keyby
- decrement valueTimeoutException
CacheException
public boolean delete(String key) throws TimeoutException, CacheException
Cache
delete
in interface Cache
key
- the keyTimeoutException
CacheException
public void delete(Collection<String> keys) throws TimeoutException, CacheException
Cache
delete
in interface Cache
TimeoutException
CacheException
public void flush() throws TimeoutException, CacheException
Cache
flush
in interface Cache
TimeoutException
CacheException
public <T> T get(String key, SerializationType serializationType) throws TimeoutException, CacheException
Cache
get
in interface Cache
key
- the keyserializationType
- the type of serialization to useTimeoutException
CacheException
public Map<String,Object> getBulk(Collection<String> keys, SerializationType serializationType) throws TimeoutException, CacheException
getBulk
in interface Cache
TimeoutException
CacheException
public long incr(String key, int by, long def) throws TimeoutException, CacheException
Cache
incr
in interface Cache
key
- the keyby
- increment valuedef
- initial valueTimeoutException
CacheException
public long incr(String key, int by, long def, int exp) throws TimeoutException, CacheException
Cache
incr
in interface Cache
key
- the keyby
- increment valuedef
- initial valueexp
- expiration time in seconds as defined in memcached specificationTimeoutException
CacheException
public boolean isEnabled()
public <T> void set(String key, int exp, Object value, SerializationType serializationType) throws TimeoutException, CacheException
Cache
set
in interface Cache
key
- stored keyexp
- expiration time in seconds as defined in memcached specificationvalue
- stored dataserializationType
- the type of serialization to useTimeoutException
CacheException
public <T> void setSilently(String cacheKey, int expiration, Object value, SerializationType serializationType)
Cache
setSilently
in interface Cache
cacheKey
- stored keyexpiration
- expiration time in seconds as defined in memcached specificationvalue
- stored dataserializationType
- the type of serialization to usepublic Long getCounter(String cacheKey) throws TimeoutException, CacheException
Cache
getCounter
in interface Cache
TimeoutException
CacheException
public void setCounter(String cacheKey, int expiration, long value) throws TimeoutException, CacheException
Cache
setCounter
in interface Cache
cacheKey
- the keyexpiration
- expiration time in seconds as defined in memcached specificationvalue
- the valueTimeoutException
CacheException
public void shutdown()
Cache
public Object getNativeClient()
Cache
getNativeClient
in interface Cache
Copyright © 2019. All rights reserved.