fixed cache to handle the edge case when there max items is reached and a new item is added, improved tests