Is there some collection implementation supporting expiration of the elements.
For example:
Collection<User> cachedUsers = new ExpirableList<User>(10000);
where
public ExpirableList(final long timeout){...}
And after given time (10000ms
in this particular example), added elements will be removed from the collection. By using this, we will prevent overflow of our cachedUsers
collection.