public class CaffeineCache<K extends IMeasurableMemory,V extends IMeasurableMemory> extends java.lang.Object implements ICache<K,V>
Modifier and Type | Method and Description |
---|---|
long |
capacity() |
void |
clear() |
boolean |
containsKey(K key) |
static <K extends IMeasurableMemory,V extends IMeasurableMemory> |
create(long weightedCapacity) |
static <K extends IMeasurableMemory,V extends IMeasurableMemory> |
create(long weightedCapacity,
com.github.benmanes.caffeine.cache.Weigher<K,V> weigher)
Initialize a cache with initial capacity with weightedCapacity
|
V |
get(K key) |
java.util.Iterator<K> |
hotKeyIterator(int n) |
boolean |
isEmpty() |
java.util.Iterator<K> |
keyIterator() |
void |
put(K key,
V value) |
boolean |
putIfAbsent(K key,
V value) |
void |
remove(K key) |
boolean |
replace(K key,
V old,
V value) |
void |
setCapacity(long capacity) |
int |
size() |
long |
weightedSize() |
public static <K extends IMeasurableMemory,V extends IMeasurableMemory> CaffeineCache<K,V> create(long weightedCapacity, com.github.benmanes.caffeine.cache.Weigher<K,V> weigher)
public static <K extends IMeasurableMemory,V extends IMeasurableMemory> CaffeineCache<K,V> create(long weightedCapacity)
public void setCapacity(long capacity)
setCapacity
in interface CacheSize
public boolean isEmpty()
public long weightedSize()
weightedSize
in interface CacheSize
public void clear()
clear
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public V get(K key)
get
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public void put(K key, V value)
put
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public boolean putIfAbsent(K key, V value)
putIfAbsent
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public boolean replace(K key, V old, V value)
replace
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public void remove(K key)
remove
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public java.util.Iterator<K> keyIterator()
keyIterator
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public java.util.Iterator<K> hotKeyIterator(int n)
hotKeyIterator
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
public boolean containsKey(K key)
containsKey
in interface ICache<K extends IMeasurableMemory,V extends IMeasurableMemory>
Copyright © 2009- The Apache Software Foundation