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 voidadd(K key, Object offsetValue)longcapacity()ObjectcomputeIfAbsent(K key, Function<? super K,? super Object> mapping)ObjectcomputeIfPresent(K key, BiFunction<? super K,? super Object,? super Object> remapping)booleancontains(K key, Object entry)voidforEach(BiFunction<? super K,? super Object,Boolean> action)Objectget(K key)<T> Tget(K key, Class<T> clazz)booleanisFull()
-
-
-
Method Detail
-
contains
public boolean contains(K key, Object entry)
- Specified by:
containsin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
add
public void add(K key, Object offsetValue)
- Specified by:
addin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
public Object get(K key)
- Specified by:
getin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
public <T> T get(K key, Class<T> clazz)
- Specified by:
getin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
computeIfAbsent
public Object computeIfAbsent(K key, Function<? super K,? super Object> mapping)
- Specified by:
computeIfAbsentin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
computeIfPresent
public Object computeIfPresent(K key, BiFunction<? super K,? super Object,? super Object> remapping)
- Specified by:
computeIfPresentin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
isFull
public boolean isFull()
- Specified by:
isFullin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
capacity
public long capacity()
- Specified by:
capacityin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
forEach
public void forEach(BiFunction<? super K,? super Object,Boolean> action)
- Specified by:
forEachin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
-