It appears that TTL cache exhibits quadratic performance (+ its evict is buggy)

Details

Type: Bug

Status:Closed

Priority: Critical

Resolution:
Completed

Labels:

None

Description

The library looks useful, thanks!

I looked at the code, and unless I'm mistaken, every cache miss seems to result in a full pass over the entire cache to evict old entries. The performance implications of this would be unacceptable for my target application. Replacing the TTL data structure with a persistent analog of a LinkedHashMap and using a take-while instead could fix this problem.

Also, evict seems to pass the cache in twice, rather than the cache and the TTL...