예제 #1
0
 public void Save()
 {
     memoryCacheProvider.Set(CategoriesKey, Categories, TimeSpan.MaxValue);
     memoryCacheProvider.Set(CoursesKey, Courses, TimeSpan.MaxValue);
     memoryCacheProvider.Set(OrdersKey, Orders, TimeSpan.MaxValue);
     memoryCacheProvider.Set(OrderItemsKey, OrderItemsKey, TimeSpan.MaxValue);
 }
        public static TModel Set <TModel>(this IMemoryCacheProvider cacheProvider, object id, TModel value, DateTimeOffset?absoluteExpiration)
        {
            var cacheItem = cacheProvider.ModelKeyGenerator.CreateCacheItem <TModel>(id);

            cacheItem.AbsoluteExpiration = absoluteExpiration;
            return(cacheProvider.Set(cacheItem, value));
        }
        public static TModel Set <TModel>(this IMemoryCacheProvider cacheProvider, object id, TModel value)
        {
            var cacheItem = cacheProvider.ModelKeyGenerator.CreateCacheItem <TModel>(id);

            return(cacheProvider.Set(cacheItem, value));
        }