Package org.aksw.commons.cache.plain
Class ClaimingCacheOld<K,V>
java.lang.Object
org.aksw.commons.cache.plain.ClaimingCacheOld<K,V>
- Type Parameters:
K-V-
An extension of loading cache that allows for making explicit
references to cached entries such that they won't be evicted.
Uses 'smart' references.
The cache:
Upon load, the cache first checks whether for the key there is already a claimed reference.
Upon load it references its own item, and releases this reference upon removal.
Claiming: Claiming an item acquires an additional reference and adds that reference to the claimed map.
When a claimed item is no longer referenced, the item is put back to cache.
- Author:
- raven
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClaim a reference to the key's entry.claimIfPresent(K key) Cannot raise an ExecutionException because it does not trigger loadingclaimUnsafe(K key) static <K,V> ClaimingCacheOld<K, V> create(com.google.common.cache.CacheBuilder<Object, Object> cacheBuilder, Function<K, Ref<V>> cacheLoader, com.google.common.cache.RemovalListener<K, Ref<V>> removalListener) void<V> Ref<V>
-
Field Details
-
cache
-
claimed
-
-
Constructor Details
-
ClaimingCacheOld
-
-
Method Details
-
create
-
link
-
claimUnsafe
-
claim
Claim a reference to the key's entry.- Parameters:
key-- Returns:
- Throws:
ExecutionException
-
claimIfPresent
Cannot raise an ExecutionException because it does not trigger loading -
invalidateAll
public void invalidateAll()
-