SyncLocalCache.ashx.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Web;
  4. namespace CB.Web.Kjh
  5. {
  6. /// <summary>
  7. /// 同步本地缓存
  8. /// </summary>
  9. public class SyncLocalCache : IHttpHandler
  10. {
  11. public void ProcessRequest(HttpContext context)
  12. {
  13. context.Response.ContentType = "text/plain";
  14. string cacheKey = context.Request.QueryString["cacheKey"];
  15. string passKey = context.Request.QueryString["passKey"];
  16. if (string.IsNullOrEmpty(cacheKey) || string.IsNullOrEmpty(passKey))
  17. {
  18. context.Response.Write("CacheKey or PassKey is not null!");
  19. return;
  20. }
  21. if (cacheKey != CB.Common.XXTEA.Decode(passKey))
  22. {
  23. context.Response.Write("AuthCode is not valid!");
  24. return;
  25. }
  26. //var cache = new CB.Cache.DefaultCacheStrategy();
  27. var cache = CB.Cache.CBCache.GetCacheService();
  28. cache.RemoveObject(cacheKey);
  29. context.Response.Write("OK");
  30. }
  31. public bool IsReusable
  32. {
  33. get
  34. {
  35. return false;
  36. }
  37. }
  38. }
  39. }