How the ASP.NET Server HttpHandler Server Response Cache

I have a custom HttpHandler in my ASP.NET application that basically creates and returns a javascript object. I have no experience with server-side caching, and my (possibly incompetent) Google searches do not return anything basic to get me started.

Can someone provide a very simple example to give me an idea of ​​how to access the server side cache server and use the cache server, or leave some links to get me started? Many thanks.

Additional info: I'm on IIS 6, and my code is in C # (although the VB example will also work).

+5
source share
1

, , :

public void ProcessRequest(HttpContext context) {
  MyObject thing = context.Cache["object_name"];
  if (thing == null) {
    thing = new MyObject();
    context.Cache["object_name"] = thing;
  }

  // use thing here to process request
}
+4

All Articles