public static void SetIssueDetails( this IMemoryCache cache, IssueDetailsServiceModel issue, ICacheKeyHolderService <int> cacheKeyHolder) { var cacheOptions = new MemoryCacheEntryOptions() .SetAbsoluteExpiration(TimeSpan.FromMinutes(1)); cache.Set(GetCacheKey(issue.Id), issue, cacheOptions); cacheKeyHolder.AddKey(nameof(IssueDetailsServiceModel), issue.Id); }
public IssueDetailsServiceModel GetIssue(int issueId, string userId) { var currentIssue = dbContext.Issues.Find(issueId); if (currentIssue == null) { return(null); } var serviceModel = new IssueDetailsServiceModel { Id = currentIssue.Id }; return(serviceModel); }