Package com.saicone.delivery4j.cache
Class CaffeineCache
java.lang.Object
com.saicone.delivery4j.MessageChannel.Cache
com.saicone.delivery4j.cache.CaffeineCache
Caffeine integration for message ID caching.
-
Constructor Summary
ConstructorsConstructorDescriptionCaffeineCache(long duration, @NotNull TimeUnit unit) Constructs a caffeine cache with provided expiration. -
Method Summary
Methods inherited from class com.saicone.delivery4j.MessageChannel.Cache
generate, of
-
Constructor Details
-
CaffeineCache
Constructs a caffeine cache with provided expiration.- Parameters:
duration- the length of time after a message ID is automatically removed.unit- the unit thatdurationis expressed in.
-
-
Method Details
-
save
protected void save(int id) Description copied from class:MessageChannel.CacheSave message ID.- Specified by:
savein classMessageChannel.Cache- Parameters:
id- the ID of the message to save.
-
contains
public boolean contains(int id) Description copied from class:MessageChannel.CacheCheck if the current cache contains the provided message ID.- Specified by:
containsin classMessageChannel.Cache- Parameters:
id- the ID of the message.- Returns:
- true if the message is already saved, false otherwise.
-
clear
public void clear()Description copied from class:MessageChannel.CacheClear the current cache instance values.- Specified by:
clearin classMessageChannel.Cache
-