示例#1
0
        public CacheContext(ICacheValidator context, IHandlerContext handlerContext)
            : base(context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (handlerContext == null)
            {
                throw new ArgumentNullException(nameof(handlerContext));
            }

            _handlerContext = handlerContext;

            Request = handlerContext.Request;
            Uri     = Request?.RequestUri.Normalize();
            Token   = handlerContext.Token;

            HandlerRegister           = context.HandlerRegister;
            ResultInspector           = context.ResultInspector;
            RequestValidator          = context.RequestValidator;
            ResponseValidator         = context.ResponseValidator;
            RevalidateValidator       = context.RevalidateValidator;
            AllowStaleResultValidator = context.AllowStaleResultValidator;
        }
示例#2
0
 public void Set(string key, object value, ICacheValidator validator)
 {
     Remove(key);
     CachedItems.Add(new CacheItem {
         Key = key, Value = value, Validator = validator
     });
 }
示例#3
0
 public CacheItem()
 {
     Validator = NullCacheValidator.Instance;
 }
示例#4
0
 public static void Set(this ICacheManager cache, string groupKey, string key, object value, ICacheValidator validator)
 {
     GetGroup(cache, groupKey).Set(key, value, validator);
 }