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 TypeMethodDescriptionvoid
long
capacity()
computeIfAbsent
(K key, Function<? super K, ? super Object> mapping) computeIfPresent
(K key, BiFunction<? super K, ? super Object, ? super Object> remapping) boolean
void
forEach
(BiFunction<? super K, ? super Object, Boolean> action) <T> T
boolean
isFull()
-
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:
contains
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
add
- Specified by:
add
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
- Specified by:
get
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
get
- Specified by:
get
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-
computeIfAbsent
- 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
- Specified by:
forEach
in interfaceorg.apache.camel.resume.cache.ResumeCache<K>
-