public static void SetArcDetails( this IMemoryCache cache, ArcDetailsServiceModel arc, ICacheKeyHolderService <int> cacheKeyHolder) { var cacheOptions = new MemoryCacheEntryOptions() .SetAbsoluteExpiration(TimeSpan.FromMinutes(1)); cache.Set(GetCacheKey(arc.Id), arc, cacheOptions); cacheKeyHolder.AddKey(nameof(ArcDetailsServiceModel), arc.Id); }
public ArcDetailsServiceModel GetArc(int arcId, string userId) { var currentArc = dbContext.Arcs.Find(arcId); if (currentArc == null) { return(null); } var serviceModel = new ArcDetailsServiceModel { Id = currentArc.Id }; return(serviceModel); }