Class SimpleCache<K,V>
java.lang.Object
org.incendo.cloud.processors.cache.SimpleCache<K,V>
- Type Parameters:
K- key typeV- value type
- All Implemented Interfaces:
CloudCache<K,V>
@API(status=STABLE,
since="1.0.0")
public final class SimpleCache<K,V>
extends Object
implements CloudCache<K,V>
Implementation of
CloudCache backed by a WeakHashMap. It is not recommended to
use this implementation, and it should only be used if CaffeineCache or GuavaCache may
not be used.
This will not enforce any size constraints.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeletes the entry identified by the givenkey.getIfPresent(@NonNull K key) Returns the value identified by the givenkey, if it exists.static <K,V> @NonNull CloudCache<K, V> of()Creates a newSimpleCacheinstance.popIfPresent(@NonNull K key) Deletes the value identified by the givenkeyand returns the value.voidStores the givenvalueidentified by the givenkey.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.incendo.cloud.processors.cache.CloudCache
get, keyExtractingView
-
Constructor Details
-
SimpleCache
public SimpleCache()
-
-
Method Details
-
of
Creates a newSimpleCacheinstance.- Type Parameters:
K- key typeV- value type- Returns:
- the created cache instance
-
delete
Description copied from interface:CloudCacheDeletes the entry identified by the givenkey.- Specified by:
deletein interfaceCloudCache<K,V> - Parameters:
key- the key
-
put
Description copied from interface:CloudCacheStores the givenvalueidentified by the givenkey.- Specified by:
putin interfaceCloudCache<K,V> - Parameters:
key- the keyvalue- the value
-
getIfPresent
Description copied from interface:CloudCacheReturns the value identified by the givenkey, if it exists.- Specified by:
getIfPresentin interfaceCloudCache<K,V> - Parameters:
key- the key- Returns:
- the value, or
null
-
popIfPresent
Description copied from interface:CloudCacheDeletes the value identified by the givenkeyand returns the value.- Specified by:
popIfPresentin interfaceCloudCache<K,V> - Parameters:
key- the key- Returns:
- the value, or
null
-