public interface CacheStorage
CacheStorageSerializers available in the CacheStorageFactory when executing
CacheStorageFactory#createStorage(CacheStorageFactoryContext);
In case serializers are used, implementations should follow this rule:
If a value was serialized to be stored put(String, Object), it should be deserialized when returned
get(String) That means that, weather or not the value was serialized, the following should always be true:
storage.put("KEY", object);
Object retrievedObject = storage.get("KEY").get();
assert object.getClass().isAssignableFrom(retrievedObject.class) == true
| Modifier and Type | Method and Description |
|---|---|
<V> Optional<V> |
get(String key)
Get the value from the cache associated with the key
|
Set<String> |
getAllKeys()
Deprecated.
#removeIf(Predicate) should be implemented in order to prevent OOM issues. This method won't be called by MTS
since version
4.4.0 but won't be removed in order to avoid breaking backwards compatibility. |
<V> V |
put(String key,
V value)
Add the value related with this key to the cache
|
void |
remove(String... keys)
Remove the values associated with the keys provided from the cache
|
default void |
removeIf(Predicate<? super String> filter)
Remove the values associated with the key filter provided from the cache
|
<V> Optional<V> get(String key)
key - the key used to identify the value in the storageOptional with the value stored or Optional.empty() if none found.<V> V put(String key, V value)
key - the key to use to locate the valuevalue - the value to be storedvoid remove(String... keys)
keys - the keys to locate the values to removedefault void removeIf(Predicate<? super String> filter)
filter - a predicate to define keys for values to be removed@Deprecated Set<String> getAllKeys()
4.4.0 but won't be removed in order to avoid breaking backwards compatibility. with all the keys being used in the storage. As the amount of keys to be stored in cache could
be bigger, implementations should provide a Set with streaming support in order to prevent an out of memory.Copyright © 2023 MuleSoft, Inc.. All rights reserved.