public class AerospikeCache extends Object implements Cache
Cache implementation backed by Aerospike database as store.
Create and configure Aerospike cache instances via AerospikeCacheManager.Cache.ValueRetrievalException, Cache.ValueWrapper| Constructor and Description |
|---|
AerospikeCache(String name,
com.aerospike.client.IAerospikeClient client,
AerospikeConverter aerospikeConverter,
AerospikeCacheConfiguration cacheConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the cache by truncating the configured cache's set (in the configured namespace).
|
void |
evict(Object key)
Deletes the key from Aerospike database.
|
Cache.ValueWrapper |
get(Object key)
Returns the value (bins) from the Aerospike database to which this cache maps the specified key.
|
<T> T |
get(Object key,
Callable<T> valueLoader)
Return the value (bins) from the Aerospike database to which this cache maps the specified key, obtaining that value from valueLoader if necessary.
|
<T> T |
get(Object key,
Class<T> type)
Return the value (bins) from the Aerospike database to which this cache maps the specified key.
|
String |
getName()
Get cache's name.
|
Object |
getNativeCache()
Get the underlying native cache provider - the Aerospike client.
|
void |
put(Object key,
Object value)
Write the key-value pair to Aerospike database.
|
Cache.ValueWrapper |
putIfAbsent(Object key,
Object value)
Write the key-value pair to Aerospike database if the key doesn't already exists.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevictIfPresent, invalidatepublic AerospikeCache(String name, com.aerospike.client.IAerospikeClient client, AerospikeConverter aerospikeConverter, AerospikeCacheConfiguration cacheConfiguration)
public void clear()
public void evict(Object key)
public String getName()
public Object getNativeCache()
getNativeCache in interface Cachepublic <T> T get(Object key, Callable<T> valueLoader)
public <T> T get(Object key, Class<T> type)
get in interface Cachekey - The key whose associated value (bins) is to be returned.type - The required type of the returned value (may be null to bypass a type check; in case of a null value found in the cache, the specified type is irrelevant).public Cache.ValueWrapper get(Object key)
get in interface Cachekey - The key whose associated value (bins) is to be returned.public Cache.ValueWrapper putIfAbsent(Object key, Object value)
putIfAbsent in interface Cachekey - The key to write.value - The value (bins) to write.Copyright © 2020–2021 Aerospike, Inc. All rights reserved.