修改缓存
							parent
							
								
									3de5142a5b
								
							
						
					
					
						commit
						796b3cf710
					
				| 
						 | 
				
			
			@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
 | 
			
		|||
using Microsoft.Extensions.Caching.Memory;
 | 
			
		||||
using IRaCIS.Core.Application.Filter;
 | 
			
		||||
using DocumentFormat.OpenXml.Drawing;
 | 
			
		||||
using EasyCaching.Core;
 | 
			
		||||
 | 
			
		||||
namespace IRaCIS.Application.Services
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -45,6 +46,7 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
        private readonly IRepository<OrganInfo> _organInfoRepository;
 | 
			
		||||
        private readonly IRepository<TrialDocument> _trialDocumentRepository;
 | 
			
		||||
        private readonly IRepository<User> _userRepository;
 | 
			
		||||
        private readonly IEasyCachingProvider _provider;
 | 
			
		||||
        private readonly IRepository<ReadingCustomTag> _readingCustomTagRepository;
 | 
			
		||||
        private readonly IRepository<ReadingTaskQuestionMark> _readingTaskQuestionMarkRepository;
 | 
			
		||||
        private readonly IRepository<ReadingSystemCriterionDictionary> _readingCriterionDictionaryRepository;
 | 
			
		||||
| 
						 | 
				
			
			@ -86,6 +88,7 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
                  IRepository<OrganInfo> organInfoRepository,
 | 
			
		||||
                  IRepository<TrialDocument> trialDocumentRepository,
 | 
			
		||||
                  IRepository<User> userRepository,
 | 
			
		||||
                  IEasyCachingProvider provider,
 | 
			
		||||
                  IRepository<ReadingCustomTag> readingCustomTagRepository,
 | 
			
		||||
                      IRepository<ReadingTaskQuestionMark> readingTaskQuestionMarkRepository,
 | 
			
		||||
                  IMemoryCache cache,
 | 
			
		||||
| 
						 | 
				
			
			@ -125,6 +128,7 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
            this._organInfoRepository = organInfoRepository;
 | 
			
		||||
            this._trialDocumentRepository = trialDocumentRepository;
 | 
			
		||||
            this._userRepository = userRepository;
 | 
			
		||||
            this._provider = provider;
 | 
			
		||||
            this._readingCustomTagRepository = readingCustomTagRepository;
 | 
			
		||||
            this._readingTaskQuestionMarkRepository = readingTaskQuestionMarkRepository;
 | 
			
		||||
            this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository;
 | 
			
		||||
| 
						 | 
				
			
			@ -2516,10 +2520,13 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
        public async Task VerifyReadingRestTime()
 | 
			
		||||
        {
 | 
			
		||||
            var cacheKey = _userInfo.Id.ToString();
 | 
			
		||||
            var value = _cache.Get(cacheKey);
 | 
			
		||||
 | 
			
		||||
          
 | 
			
		||||
            var value = _provider.Get<string>(cacheKey).Value;
 | 
			
		||||
            if (value == null)
 | 
			
		||||
            {
 | 
			
		||||
                _cache.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5));
 | 
			
		||||
                _provider.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5));
 | 
			
		||||
              //  _cache.Set(cacheKey, DateTime.Now.ToString(), TimeSpan.FromHours(5));
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
| 
						 | 
				
			
			@ -2534,7 +2541,8 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
                else if (timespanMin > 140)
 | 
			
		||||
                {
 | 
			
		||||
                    cacheDate = cacheDate.AddMinutes((Math.Floor((double)(timespanMin / 140))) * 140);
 | 
			
		||||
                    _cache.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
 | 
			
		||||
                    _provider.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
 | 
			
		||||
                   // _cache.Set(cacheKey, cacheDate.ToString(), TimeSpan.FromHours(5));
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                #endregion
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue