refactored CacheKey handling