Fixed cache thread safety