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 thatduration
is expressed in.
-
-
Method Details
-
save
protected void save(int id) Description copied from class:MessageChannel.Cache
Save message ID.- Specified by:
save
in classMessageChannel.Cache
- Parameters:
id
- the ID of the message to save.
-
contains
public boolean contains(int id) Description copied from class:MessageChannel.Cache
Check if the current cache contains the provided message ID.- Specified by:
contains
in 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.Cache
Clear the current cache instance values.- Specified by:
clear
in classMessageChannel.Cache
-