Refactored out duplicate code in async cache