jhalterman / expiringmap

A high performance thread-safe map that expires entries
Apache License 2.0
1k stars 142 forks source link

Add an onTimeUpdate Event #81

Open Gagafeee opened 1 year ago

Gagafeee commented 1 year ago

I was thinking, how can i execute a function each time the expiration Time decrease like

ExpiringMap<K, V> Timer = ExpiringMap.builder()
.expiration(10, TimeUnit.SECONDS)
.onTimeUpdate( setTime() )
.build();

Where setTime() is called each second until the value expire.

function called depending on TimeUnit value called each milisecond if the expiration time is writed in milisecond