expiringmap icon indicating copy to clipboard operation
expiringmap copied to clipboard

Is it possible never expired in Variable Expiration Map?

Open deanwong opened this issue 9 years ago • 3 comments

when I use put(K key, V value) the default expiration time is 1 min.

deanwong avatar Mar 03 '17 16:03 deanwong

ExpiringMap always wants to expire things, thus the name :)

The best you can do is set expiration to be something very far off: such as Integer.MAX_VALUE TimeUnit.DAYS.

jhalterman avatar Mar 20 '17 00:03 jhalterman

Is it possible to use -1? In this case it should not expire at all right?

buderjoh avatar Jul 02 '19 14:07 buderjoh

Is your use case trying to mix things that should never expire with things that do in the same map? Currently there's no way to indicate that an entry should never expire, but I'd be happy to take a PR that allows negative values to indicate an entry should not expire.

If someone is up for this, this would and should only work with dynamic expiration though, else the put should be rejected with IllegalArgumentException.

jhalterman avatar Jul 26 '19 03:07 jhalterman