-
- All Implemented Interfaces:
-
org.readium.r2.shared.util.MemoryObserver,org.readium.r2.shared.util.SuspendingCloseable,org.readium.r2.shared.util.cache.Cache
public final class InMemoryCache<V extends Object> implements Cache<V>
A basic in-memory cache.
-
-
Constructor Summary
Constructors Constructor Description InMemoryCache()
-
Method Summary
Modifier and Type Method Description <T extends Any> Ttransaction(SuspendFunction1<CacheTransaction<V>, T> block)Performs an atomic block transaction on this cache. Unitclose()Closes this object and releases any resources associated with it. UnitonTrimMemory(MemoryObserver.Level level)Called by the system when memory needs to be freed. -
-
Method Detail
-
transaction
<T extends Any> T transaction(SuspendFunction1<CacheTransaction<V>, T> block)
Performs an atomic block transaction on this cache.
-
close
Unit close()
Closes this object and releases any resources associated with it. If the object is already closed then invoking this method has no effect.
-
onTrimMemory
Unit onTrimMemory(MemoryObserver.Level level)
Called by the system when memory needs to be freed.
Release unused resources according to the level.
-
-
-
-