Class CacheUtilities
- java.lang.Object
-
- org.glassfish.hk2.utilities.cache.CacheUtilities
-
public class CacheUtilities extends java.lang.Object
Utilities for creating caches
-
-
Constructor Summary
Constructors Constructor Description CacheUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
WeakCARCache<K,V>createWeakCARCache(Computable<K,V> computable, int maxSize, boolean isWeak)
Returns a WEAKCarCache with the given computable and the given maximum value size of the cache.
-
-
-
Method Detail
-
createWeakCARCache
public static <K,V> WeakCARCache<K,V> createWeakCARCache(Computable<K,V> computable, int maxSize, boolean isWeak)
Returns a WEAKCarCache with the given computable and the given maximum value size of the cache. The Cache returned will have weak keys, so that when the key becomes only weakly reachable it will be removed from the cache. However, values will only be removed from the Cache when an operation is performed on the cache or the methodWeakCARCache.clearStaleReferences()
is called- Parameters:
computable
- The computable that is used to get the V from the given KmaxSize
- The maximumSize of the cacheisWeak
- if true this will keep weak keyes, if false the keys will be hard and will not go away even if they do not exist anywhere else but this cache- Returns:
- A WeakCARCache that is empty
-
-