HandlerFun.ashx.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Web;
  2. using CB.Cache;
  3. namespace CB.Web.Kjh.WebServices
  4. {
  5. /// <summary>
  6. /// HandlerFun 的摘要说明
  7. /// </summary>
  8. public class HandlerFun : IHttpHandler
  9. {
  10. public void ProcessRequest(HttpContext context)
  11. {
  12. context.Response.ContentType = "text/html";
  13. string action = context.Request.QueryString["action"].ToString().Trim();
  14. string cachekey = context.Request.QueryString["cachekey"].ToString().Trim();
  15. switch (action)
  16. {
  17. case "removecache":
  18. RemoveCache(context, cachekey);
  19. break;
  20. }
  21. }
  22. /// <summary>
  23. /// 清空缓存
  24. /// </summary>
  25. /// <param name="context"></param>
  26. /// <param name="cachekey"></param>
  27. private void RemoveCache(HttpContext context, string cachekey)
  28. {
  29. if (!string.IsNullOrEmpty(cachekey))
  30. {
  31. CBCache.GetCacheService().RemoveObject(cachekey);
  32. }
  33. context.Response.Write("success");
  34. }
  35. public bool IsReusable
  36. {
  37. get
  38. {
  39. return false;
  40. }
  41. }
  42. }
  43. }