Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Implemented
-
None
-
None
Description
This is a Map decorator which passively evicts expired keys once their expiry time has been reached.
When putting a key-value pair in the map, this decorator calls expiryTime(key, value), passing the key and the value as parameters, and uses the returned value as the expiry time for that key.
When getting the value for a key, its expiry time is checked, and if it's greater than the current time, the value is returned. Otherwise, the key is removed from the decorated map, and null is returned.
Doing so, there's no need to have a separate, active thread (hence the name 'passive') to check expiry times - the check is performed on demand.
Attachments
Attachments
Issue Links
- is related to
-
COLLECTIONS-342 Add ExpiringMap
- Reopened
-
LANG-324 Weak references with time limit?
- Closed