put() method so here you can remove the eldest element from the cache.
Map
{
@Override
protected boolean removeEldestEntry(Entry
//remove after 2 hours
Calendar cal = Calendar.getInstance();
long howLongAgoInMs = System.currentTimeMillis()-eldest.getValue().lastTimeTouched;
long twoHoursInMs = 2 * 60 * 60 * 1000;
if(howLongAgoInMs > twoHoursInMs){
return true;
}
return false;
}
};