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
ConstructorsConstructorDescriptionCaffeineCache(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
Modifier and TypeMethodDescriptionvoidlongcapacity()computeIfAbsent(K key, Function<? super K, ? super Object> mapping) computeIfPresent(K key, BiFunction<? super K, ? super Object, ? super Object> remapping) booleanvoidforEach(BiFunction<? super K, ? super Object, Boolean> action) <T> TbooleanisFull()
-
Constructor Details
-
CaffeineCache
public CaffeineCache(long cacheSize) Builds a new cache with the given cache size- Parameters:
cacheSize- the cache size
-
CaffeineCache
Builds a new instance of this object- Parameters:
cache- an instance of a pre-constructed cache objectcacheSize- the size of the pre-constructed cache object
-
-
Method Details
-
contains
- Specified by:
containsin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
add
- Specified by:
addin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
- Specified by:
getin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
- Specified by:
getin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
computeIfAbsent
- 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
- Specified by:
forEachin interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-