ravaelamanov commented on issue #11775:
URL: https://github.com/apache/ignite/issues/11775#issuecomment-2563420036

   Well, that's the thing, I need to specify expiration duration on the cache 
level:
   
   ```java
   IgniteCache cache = ignite.cache("myCache")
           .withExpiryPolicy(new CreatedExpiryPolicy(new 
Duration(TimeUnit.MINUTES, 5)));
   ```
   
   and all of the entries for the cache will have the same expiration duration. 
What I want to achieve is setting **different durations** for entries **in the 
same cache**. Consider the API Caffeine provides 
(https://github.com/ben-manes/caffeine/wiki/Eviction#time-based):
   
   ```java
   public interface Expiry<K, V> {
     long expireAfterCreate(K key, V value, long currentTime);
   
     long expireAfterUpdate(K key, V value, long currentTime, @NonNegative long 
currentDuration);
   
     long expireAfterRead(K key, V value, long currentTime, @NonNegative long 
currentDuration);
   }
   ```
   
   Key and value are passed to methods determining expiration duration and one 
can set expiration duration based on them. This is what I mean by per-entry 
expiration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to