修改缓存
parent
8b124e1c60
commit
a53626b66c
|
@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
using IRaCIS.Core.Application.Filter;
|
using IRaCIS.Core.Application.Filter;
|
||||||
using DocumentFormat.OpenXml.Drawing;
|
using DocumentFormat.OpenXml.Drawing;
|
||||||
|
using EasyCaching.Core;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
using IRaCIS.Application.Services.BackGroundJob;
|
using IRaCIS.Application.Services.BackGroundJob;
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ namespace IRaCIS.Application.Services
|
||||||
private readonly IRepository<OrganInfo> _organInfoRepository;
|
private readonly IRepository<OrganInfo> _organInfoRepository;
|
||||||
private readonly IRepository<TrialDocument> _trialDocumentRepository;
|
private readonly IRepository<TrialDocument> _trialDocumentRepository;
|
||||||
private readonly IRepository<User> _userRepository;
|
private readonly IRepository<User> _userRepository;
|
||||||
|
private readonly IEasyCachingProvider _provider;
|
||||||
private readonly IRepository<ReadingCustomTag> _readingCustomTagRepository;
|
private readonly IRepository<ReadingCustomTag> _readingCustomTagRepository;
|
||||||
private readonly IRepository<ReadingSystemCriterionDictionary> _readingCriterionDictionaryRepository;
|
private readonly IRepository<ReadingSystemCriterionDictionary> _readingCriterionDictionaryRepository;
|
||||||
private readonly IRepository<ReadingTrialCriterionDictionary> _readingTrialCriterionDictionaryRepository;
|
private readonly IRepository<ReadingTrialCriterionDictionary> _readingTrialCriterionDictionaryRepository;
|
||||||
|
@ -87,6 +89,7 @@ namespace IRaCIS.Application.Services
|
||||||
IRepository<OrganInfo> organInfoRepository,
|
IRepository<OrganInfo> organInfoRepository,
|
||||||
IRepository<TrialDocument> trialDocumentRepository,
|
IRepository<TrialDocument> trialDocumentRepository,
|
||||||
IRepository<User> userRepository,
|
IRepository<User> userRepository,
|
||||||
|
IEasyCachingProvider provider,
|
||||||
IRepository<ReadingCustomTag> readingCustomTagRepository,
|
IRepository<ReadingCustomTag> readingCustomTagRepository,
|
||||||
IMemoryCache cache,
|
IMemoryCache cache,
|
||||||
IRepository<ReadingSystemCriterionDictionary> readingCriterionDictionaryRepository,
|
IRepository<ReadingSystemCriterionDictionary> readingCriterionDictionaryRepository,
|
||||||
|
@ -127,6 +130,7 @@ namespace IRaCIS.Application.Services
|
||||||
this._organInfoRepository = organInfoRepository;
|
this._organInfoRepository = organInfoRepository;
|
||||||
this._trialDocumentRepository = trialDocumentRepository;
|
this._trialDocumentRepository = trialDocumentRepository;
|
||||||
this._userRepository = userRepository;
|
this._userRepository = userRepository;
|
||||||
|
this._provider = provider;
|
||||||
this._readingCustomTagRepository = readingCustomTagRepository;
|
this._readingCustomTagRepository = readingCustomTagRepository;
|
||||||
this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository;
|
this._readingCriterionDictionaryRepository = readingCriterionDictionaryRepository;
|
||||||
this._tumorAssessmentRepository = tumorAssessmentRepository;
|
this._tumorAssessmentRepository = tumorAssessmentRepository;
|
||||||
|
@ -2470,10 +2474,13 @@ namespace IRaCIS.Application.Services
|
||||||
public async Task VerifyReadingRestTime()
|
public async Task VerifyReadingRestTime()
|
||||||
{
|
{
|
||||||
var cacheKey = _userInfo.Id.ToString();
|
var cacheKey = _userInfo.Id.ToString();
|
||||||
var value = _cache.Get(cacheKey);
|
|
||||||
|
|
||||||
|
var value = _provider.Get<string>(cacheKey).Value;
|
||||||
if (value == null)
|
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
|
else
|
||||||
|
@ -2488,7 +2495,8 @@ namespace IRaCIS.Application.Services
|
||||||
else if (timespanMin > 140)
|
else if (timespanMin > 140)
|
||||||
{
|
{
|
||||||
cacheDate = cacheDate.AddMinutes((Math.Floor((double)(timespanMin / 140))) * 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
|
#endregion
|
||||||
|
|
Loading…
Reference in New Issue