I'm trying to extend the cache implementation given in book Concurrency in Practice(by Brian Goetz).
I want to extend the cache such that if any entry is not accessed in 10 seconds then it should expire. i.e removed from cache.
For this I have extended Future and FutureTask as below
As seen above I'm overriding the the get method to calculate the expiration time.
And in the main cache Class i.e
Memorizer I will start a new
thread that will periodically scan the entries and remove entries where isResultExpired returns true.
I just wanted to know if this implementation would work or there is some bug in my code?
Note I should also override
get with timeout, however to keep is concise I have omitted that.
Thanks