There is no answer to my question here!
For example, there is a ,
Map <K,V> map = new ConcurrentHashMap<>()
V - some object that can be in the Map for no more than 300 ms. When we add an element to the Map (or it could be a Queue data structure), a timer would be turned on, which would delete the element after 300 ms.
At the same time, if an element is in this primitive cache, then when accessing it, you need to update the timer for this object (that is, start counting from the beginning, for this requested object).
In fact, this is an LRU cache, it has a certain size, removes the least used element from it (I know how to do this part), but at the same time, each serviced element must have an independent timer that will remove such an element from this cache, and when such element (in that cache) updating, the timer for such an element must be reset to zero, and if no one requires the item during the specified time, the element is automatically deleted from the cache.
Who has any ideas how this could be organized?