public class NoOpBlobStore extends AbstractAsyncKeyValueStore<byte[]> implements BlobStore
key value store
that does nothing. Since no puts result in any operation, all retrieves
will always return an empty optional
. This implies any clients using this will also be holding onto
their own local copies of the key-values since persisting to this won't store them.Constructor and Description |
---|
NoOpBlobStore() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(KeyValueStore<byte[]> listener) |
void |
delete(String key,
String context) |
Map<String,byte[]> |
enumerateContext(String context) |
Optional<byte[]> |
get(String key,
String context) |
Optional<Optional<byte[]>> |
getIfStale(String key,
String context,
long timestamp) |
static BlobStore |
getInstance() |
OptionalLong |
getLastUpdated(String key,
String context) |
String |
getName() |
long |
put(String key,
byte[] value,
String context,
Integer ttlInSeconds)
Put a value with a suggested time-to-live after which the value should be expired and removed from the store.
|
deleteAsync, enumerateContextAsync, getAsync, getIfStaleAsync, getLastUpdatedAsync, putAsync, truncateContextAsync
put, putAsync, truncateContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deleteAsync, enumerateContextAsync, getAsync, getIfStaleAsync, getLastUpdatedAsync, put, putAsync, putAsync, truncateContext, truncateContextAsync
public static BlobStore getInstance()
public long put(String key, byte[] value, String context, Integer ttlInSeconds)
KeyValueStore
Records are expired on a best effort basis and depending on the implementation it is possible to get an expired record.
put
in interface KeyValueStore<byte[]>
context
- a context used to differentiate between keys with the same name (forms a compound key)ttlInSeconds
- the time to live in seconds for this key or no ttl if nullpublic Optional<byte[]> get(String key, String context)
get
in interface KeyValueStore<byte[]>
context
- a context used to differentiate between keys with the same name (forms a compound key)public Optional<Optional<byte[]>> getIfStale(String key, String context, long timestamp)
getIfStale
in interface KeyValueStore<byte[]>
context
- a context used to differentiate between keys with the same name (forms a compound key)timestamp
- the timestamp of the last known state such that if an record with a more recent timestamp is
found the provided timestamp will be considered stale and the new record will be returnedpublic OptionalLong getLastUpdated(String key, String context)
getLastUpdated
in interface KeyValueStore<byte[]>
context
- a context used to differentiate between keys with the same name (forms a compound key)public void addListener(KeyValueStore<byte[]> listener)
public String getName()
getName
in interface KeyValueStore<byte[]>
public Map<String,byte[]> enumerateContext(String context)
enumerateContext
in interface KeyValueStore<byte[]>
context
- a context used to differentiate between keys with the same name (forms a compound key)public void delete(String key, String context)
delete
in interface KeyValueStore<byte[]>
context
- a context used to differentiate between keys with the same name (forms a compound key)Copyright © 2020. All rights reserved.