Beispiel #1
0
        public HttpResponseMessage RemoveClientFromCache([FromBody] CacheResetPostModel postModel)
        {
            NameValueCollection conf = (NameValueCollection)ConfigurationManager.GetSection("WebServiceSettings");

            if (postModel.AdminPassword != conf["CacheResetKey"])
            {
                return(Request.CreateResponse(HttpStatusCode.Forbidden, "Not today", postModel.Format));
            }

            bool r = _apiThrottler.RemoveFromCache(postModel.ClientToken.ToLowerInvariant()) != null;

            new Task(() => _log.Sync()).Start();
            new Task(() => _morpherDatabase.UploadMorpherCache(_morpherCache.GetAll())).Start();

            return(Request.CreateResponse(
                       HttpStatusCode.OK,
                       r,
                       postModel.Format));
        }