Base solution for your next web application

Activities of "zyrel.sermon"

Hi

We're using the IDistributedCache to set and get data cache from redis and we're able to see logs set/get from redis, there are times that the exporting is successful and there are times that the "Requested file does not exist!" occurs is it possible that the keys we're getting are already expired?

here's a sample code

protected FileDto CreateExcelPackage(string fileName, Action<ExcelPackage> creator)
        {
            var file = new FileDto(fileName, MimeTypeNames.ApplicationVndOpenxmlformatsOfficedocumentSpreadsheetmlSheet);
            string cacheString;
            var cacheToken = _distributedCache.Get(fileName);
            if (cacheToken != null)
            {
                cacheString = Encoding.UTF8.GetString(cacheToken);
                file = JsonConvert.DeserializeObject<FileDto>(cacheString);
            }
            else
            {
                using (var excelPackage = new ExcelPackage())
                {
                    creator(excelPackage);
                    Save(excelPackage, file);
                }
                cacheString = JsonConvert.SerializeObject(file);
                cacheToken = Encoding.UTF8.GetBytes(cacheString);
                var options = new DistributedCacheEntryOptions()
                    .SetSlidingExpiration(TimeSpan.FromMinutes(1))
                    .SetAbsoluteExpiration(DateTime.Now.AddMinutes(30));
                _distributedCache.Set(fileName, cacheToken, options);
                file = this.CreateExcelPackage(fileName, creator);
            }
            return file;
        }

are we doing it wrong? please advise thanks

Hi is there any sample code snippet or docs on how we can implement redis cache in exporting file? Thanks

Hi

Do you use Redis or any other cache prodider or do you use memory cache ? ** we use memory cache Does your app have more than one instance running on production ? ** yes our app is running in multiple instance

Showing 21 to 23 of 23 entries