/// <summary> /// 以 Id 取得資料 /// </summary> /// <param name="id">The id.</param> /// <returns>Foo.</returns> public async Task <FooModel> GetAsync(Guid id) { var stepName = $"{nameof(RedisFooRepository)}.{nameof(this.GetAsync)}"; using (ProfilingSession.Current.Step(stepName)) { var cacheItem = await this.GetOrAddCacheItemAsync ( cachekey : $"{CachekeyPrefix}{Cachekeys.Foo.Get.ToFormat(id)}", cacheItemExpiration : CacheUtility.GetCacheItemExpirationOneHour(), source : async() => { var result = await this.FooRepository.GetAsync(id); return(result); } ); return(cacheItem); } }