Question on Caching an HttpHandler for Speed
Ok, I need some help with something. I'm building a HttpHandler that uses an XmlTextWriter to output some custom-generated XML to a requester. I'd like to be able to cache the generated document, because chances are good that the data won't change for a while, and I don't want to hit the DB every time. The problem is, with the following code, I don't think I can do it:
1Dim w As XmlTextWriter = New XmlTextWriter(context.Response.Output)
2w.Formatting = Formatting.Indented
3w.WriteStartDocument()
4w.WriteEndDocument()
So, what would be a better way to generate the document, store it in the cache, and output it from the cache? I'm just not familiar enough with XML in .NET to know. Thanks in advance.