Class CaffeineCache<K>
- java.lang.Object
-
- org.apache.camel.component.caffeine.resume.CaffeineCache<K>
-
- Type Parameters:
K
- The type of the key to cache
- All Implemented Interfaces:
org.apache.camel.resume.cache.ResumeCache<K>
public class CaffeineCache<K> extends Object implements org.apache.camel.resume.cache.ResumeCache<K>
This is a simple cache implementation that uses Caffeine to store the resume offsets
-
-
Constructor Summary
Constructors Constructor Description CaffeineCache(long cacheSize)
Builds a new cache with the given cache sizeCaffeineCache(com.github.benmanes.caffeine.cache.Cache<K,Object> cache, long cacheSize)
Builds a new instance of this object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(K key, Object offsetValue)
long
capacity()
Object
computeIfAbsent(K key, Function<? super K,? super Object> mapping)
Object
computeIfPresent(K key, BiFunction<? super K,? super Object,? super Object> remapping)
boolean
contains(K key, Object entry)
void
forEach(BiFunction<? super K,? super Object,Boolean> action)
Object
get(K key)
<T> T
get(K key, Class<T> clazz)
boolean
isFull()
-
-
-
Method Detail
-
contains
public boolean contains(K key, Object entry)
- Specified by:
contains
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
add
public void add(K key, Object offsetValue)
- Specified by:
add
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
public Object get(K key)
- Specified by:
get
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
public <T> T get(K key, Class<T> clazz)
- Specified by:
get
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
computeIfAbsent
public Object computeIfAbsent(K key, Function<? super K,? super Object> mapping)
- Specified by:
computeIfAbsent
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
computeIfPresent
public Object computeIfPresent(K key, BiFunction<? super K,? super Object,? super Object> remapping)
- Specified by:
computeIfPresent
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
isFull
public boolean isFull()
- Specified by:
isFull
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
capacity
public long capacity()
- Specified by:
capacity
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
forEach
public void forEach(BiFunction<? super K,? super Object,Boolean> action)
- Specified by:
forEach
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
-