Safer mutex handling in GetCacheEntry