コード例 #1
0
        //combine with delete? not sure how we would want to handle that
        //HttpPost
        internal IHttpHandler Clear()
        {
            if (!ValidateTokenHeader())
            {
                return(base.Json(new JsonErrorViewModel {
                    Success = false, Message = "Invalid verification token."
                }, HttpStatusCode.BadRequest));
            }

            var cache = new HttpCacheShim();

            cache.Clear();
            return(base.Json(new ClearViewModel {
                Success = true
            }));
        }
コード例 #2
0
        //HttpPost
        internal IHttpHandler Delete(string key, bool prefix = false)
        {
            if (!ValidateTokenHeader())
            {
                return(base.Json(new JsonErrorViewModel {
                    Success = false, Message = "Invalid verification token."
                }, HttpStatusCode.BadRequest));
            }

            if (String.IsNullOrEmpty(key))
            {
                return(base.Json(new JsonErrorViewModel {
                    Success = false, Message = "Missing cache key or prefix."
                }, HttpStatusCode.BadRequest));
            }

            var cache = new HttpCacheShim();

            cache.Clear(key, prefix);
            return(base.Json(new DeleteViewModel(cache)
            {
                Success = true
            }));
        }