Constructor and Description |
---|
CacheMemcachedImpl(org.slf4j.Logger logger,
NinjaProperties ninjaProperties) |
Modifier and Type | Method and Description |
---|---|
void |
add(String key,
Object value,
int expiration)
Add object to cache.
|
void |
clear()
Clear all values in cache.
|
long |
decr(String key,
int by)
Decrements key by value.
|
void |
delete(String key)
Delete key from cache.
|
Object |
get(String key)
Returns the object for this key or null if not found.
|
Map<String,Object> |
get(String[] keys)
Returns all objects for the keys.
|
long |
incr(String key,
int by)
Increments key by value.
|
void |
replace(String key,
Object value,
int expiration)
Replaces key with new value.
|
boolean |
safeAdd(String key,
Object value,
int expiration)
Similar to
delete method. |
boolean |
safeDelete(String key)
Similar to
delete method. |
boolean |
safeReplace(String key,
Object value,
int expiration)
Similar to
delete method. |
boolean |
safeSet(String key,
Object value,
int expiration)
Similar to
delete method. |
void |
set(String key,
Object value,
int expiration)
Adds object of cache.
|
void |
stop() |
@Inject public CacheMemcachedImpl(org.slf4j.Logger logger, NinjaProperties ninjaProperties) throws Exception
Exception
public void add(String key, Object value, int expiration)
Cache
public Object get(String key)
Cache
public void clear()
Cache
public void delete(String key)
Cache
public Map<String,Object> get(String[] keys)
Cache
public long incr(String key, int by)
Cache
public long decr(String key, int by)
Cache
public void replace(String key, Object value, int expiration)
Cache
public boolean safeAdd(String key, Object value, int expiration)
Cache
delete
method.
BUT it blocks until execution succeeds / fails AND wraps
exceptions in a simple true / false return valuepublic boolean safeDelete(String key)
Cache
delete
method.
BUT it blocks until execution succeeds / fails AND wraps
exceptions in a simple true / false return valuesafeDelete
in interface Cache
key
- The key to deletepublic boolean safeReplace(String key, Object value, int expiration)
Cache
delete
method.
BUT it blocks until execution succeeds / fails AND wraps
exceptions in a simple true / false return valuesafeReplace
in interface Cache
key
- The key of the object to use for caching.value
- The value of the object to replace in the cache.expiration
- Expiration time in seconds.public boolean safeSet(String key, Object value, int expiration)
Cache
delete
method.
BUT it blocks until execution succeeds / fails AND wraps
exceptions in a simple true / false return valuepublic void set(String key, Object value, int expiration)
Cache
public void stop()
Copyright © 2019 ninjaframework. All rights reserved.