extract cache management into new class