Top Description Constructors Methods
org.glassfish.hk2.utilities.cache

public Class CacheUtilities

extends Object
Class Inheritance
Imports
org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl

Utilities for creating caches
Author
jwells

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <K, V> WeakCARCache<K, V>

Returns:

A WeakCARCache that is empty
createWeakCARCache
(Computable<K, V>
The computable that is used to get the V from the given K
computable
,
int
The maximumSize of the cache
maxSize
,
boolean
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
isWeak
)

Returns a WEAKCarCache with the given computable and the given maximum value size of the cache.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CacheUtilitiesback to summary
public CacheUtilities()

Method Detail

createWeakCARCacheback to summary
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 method WeakCARCache#clearStaleReferences() is called

Parameters
computable:Computable<K, V>

The computable that is used to get the V from the given K

maxSize:int

The maximumSize of the cache

isWeak:boolean

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:WeakCARCache<K, V>

A WeakCARCache that is empty