Ehcache size and expire on demand

25 views
Skip to first unread message

SATNAM SINGH

unread,
Sep 9, 2024, 7:01:20 AM9/9/24
to ehcache-dev
Hi team,

I am looking for some scenarios where I want :

  1. Number of entries present in ehcache ( size of cache like but not size in mem )
  2. Expire the cache on demand like this: https://stackoverflow.com/questions/29990788/guava-ticker-cache-expire without changing the TTL of expiry 

I was looking in docs but didn't find anything which can be helpful for my use case.
can anyone help me with this :) 

Thank you 

SATNAM SINGH

unread,
Sep 9, 2024, 7:11:58 AM9/9/24
to ehcache-dev
  1. Number of entries present in ehcache: Suppose i have a student class and i have a cache of it I added 10 students how can i get size of my cache in a long i.e 10L, possibly I can iterate over the cache or forEach to get the size of keys or values present in the cache 
  2. Expire the cache on demand: Example: Student1 is added and he has 10 mins to complete a form if 10 min pass that student should be deleted from the cache. Just like how google guava cache provides ticker OOTB to advance cache time to mimic cache expiry for the cache
    1. Ex: https://stackoverflow.com/questions/29990788/guava-ticker-cache-expire

Reply all
Reply to author
Forward
0 new messages