private DistributedCacheEntryOptions Serialize <TModel>(TModel model,
                                                                Application.Infrastructure.Caching.API.CachingOptions options, out string json)
        {
            var distributedOptions = new DistributedCacheEntryOptions
            {
                AbsoluteExpirationRelativeToNow = options.AbsoluteExpireTime,
                SlidingExpiration = options.UnusedExpireTime
            };

            json = JsonConvert.SerializeObject(model);

            return(distributedOptions);
        }
 public async Task CreateAsync <TList, TModel>(TList list,
                                               Application.Infrastructure.Caching.API.CachingOptions options) where TList : IPaginatedList <TModel>
 {
     var distributedOptions = Serialize <TList, TModel>(list, options, out string json);
     await _cache.SetStringAsync(CacheListKey <TList, TModel>(), json, distributedOptions);
 }
 public async Task CreateAsync <TModel>(TModel model,
                                        Application.Infrastructure.Caching.API.CachingOptions options)
 {
     var distributedOptions = Serialize(model, options, out string json);
     await _cache.SetStringAsync(CacheKey <TModel>(), json, distributedOptions);
 }