Package jetbrains.buildServer.util
Class RecentEntriesCache<K,V>
- java.lang.Object
-
- jetbrains.buildServer.util.RecentEntriesCache<K,V>
-
public class RecentEntriesCache<K,V> extends Object
- Author:
- Pavel.Sher Date: 26.05.2008
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRecentEntriesCache.BiItemProcessor<K,V>static interfaceRecentEntriesCache.Function<K,V>protected static classRecentEntriesCache.Value<V>
-
Constructor Summary
Constructors Constructor Description RecentEntriesCache(int maxEntries)RecentEntriesCache(int maxEntries, boolean rememberNullValues)RecentEntriesCache(String cacheName, int maxEntries)RecentEntriesCache(String cacheName, int maxEntries, boolean rememberNullValues)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Map<K,V>copyEntries()protected Map<K,RecentEntriesCache.Value<V>>createCacheStorage(int maxEntries)voidforEach(ItemProcessor<V> processor)voidforEachEntry(RecentEntriesCache.BiItemProcessor<K,V> processor)Vget(K key)Collection<V>getAll(Collection<K> keys)floatgetHitRate()booleanisEmpty()Set<K>keySet()VlookupOrCompute(K key, RecentEntriesCache.Function<K,V> compute)voidput(K key, V value)voidremove(K key)voidremoveValues(Filter<V> valueFilter)intsize()StringtoString()
-
-
-
Constructor Detail
-
RecentEntriesCache
public RecentEntriesCache(int maxEntries)
-
RecentEntriesCache
public RecentEntriesCache(int maxEntries, boolean rememberNullValues)
-
RecentEntriesCache
public RecentEntriesCache(@NotNull String cacheName, int maxEntries)
-
RecentEntriesCache
public RecentEntriesCache(@NotNull String cacheName, int maxEntries, boolean rememberNullValues)Constructor.- Parameters:
maxEntries- max entries to hold in cacherememberNullValues- whether to accept null values or not
-
-
Method Detail
-
createCacheStorage
@NotNull protected Map<K,RecentEntriesCache.Value<V>> createCacheStorage(int maxEntries)
-
size
public int size()
- Returns:
- number of elements in the cache
- Since:
- 7.0
-
isEmpty
public boolean isEmpty()
- Returns:
- true of cache is empty
- Since:
- 7.0
-
getAll
@NotNull public Collection<V> getAll(@NotNull Collection<K> keys)
-
clear
public void clear()
-
remove
public void remove(@NotNull K key)
-
forEach
public void forEach(@NotNull ItemProcessor<V> processor)
-
forEachEntry
public void forEachEntry(@NotNull RecentEntriesCache.BiItemProcessor<K,V> processor)
-
lookupOrCompute
public V lookupOrCompute(@NotNull K key, @NotNull RecentEntriesCache.Function<K,V> compute)
-
getHitRate
public float getHitRate()
-
-