public async Task AddConferenceAsync(ConferenceDetailsResponse conferenceResponse) { var conference = ConferenceCacheMapper.MapConferenceToCacheModel(conferenceResponse); await _memoryCache.GetOrCreateAsync(conference.Id, entry => { entry.SlidingExpiration = TimeSpan.FromHours(4); return(Task.FromResult(conference)); }); }
public async Task AddConferenceAsync(ConferenceDetailsResponse conferenceResponse) { var conference = ConferenceCacheMapper.MapConferenceToCacheModel(conferenceResponse); var serialisedConference = JsonConvert.SerializeObject(conference, CachingHelper.SerializerSettings); var data = Encoding.UTF8.GetBytes(serialisedConference); await _distributedCache.SetAsync(conference.Id.ToString(), data, new DistributedCacheEntryOptions { SlidingExpiration = TimeSpan.FromHours(4) }); }
public async Task AddConferenceAsync(ConferenceDetailsResponse conferenceResponse) { var conference = ConferenceCacheMapper.MapConferenceToCacheModel(conferenceResponse); await UpdateConferenceAsync(conference); }