Class DefaultCache
- java.lang.Object
-
- io.fluxcapacitor.javaclient.persisting.caching.DefaultCache
-
-
Constructor Summary
Constructors Constructor Description DefaultCache()DefaultCache(int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tget(String id, Function<? super String,T> mappingFunction)Returns the value associated with the given id.<T> TgetIfPresent(String id)Returns the value associated with the given id if it exists in the cache.voidinvalidate(String id)Invalidates the cache entry mapped to given id.voidinvalidateAll()Invalidates all cache entries.voidput(String id, Object value)Adds or replaces a value in the cache.
-
-
-
Method Detail
-
put
public void put(String id, Object value)
Description copied from interface:CacheAdds or replaces a value in the cache.
-
get
public <T> T get(String id, Function<? super String,T> mappingFunction)
Description copied from interface:CacheReturns the value associated with the given id. If there is no association, the mapping function is used to calculate a value. This value will be stored in the cache.
-
getIfPresent
public <T> T getIfPresent(String id)
Description copied from interface:CacheReturns the value associated with the given id if it exists in the cache. If there is no association,nullis returned.- Specified by:
getIfPresentin interfaceCache- Type Parameters:
T- the type of object to return from the cache- Parameters:
id- The object id- Returns:
- The value associated with given id
-
invalidate
public void invalidate(String id)
Description copied from interface:CacheInvalidates the cache entry mapped to given id.- Specified by:
invalidatein interfaceCache
-
invalidateAll
public void invalidateAll()
Description copied from interface:CacheInvalidates all cache entries.- Specified by:
invalidateAllin interfaceCache
-
-