extracted CacheEntry class, refactorings, added tests