Shared data in an ASP.NET application
- by Barguast
I have a basic ASP.NET application which is used to request data which is stored on disk. This is loaded from files and sent as the response. I want to be able to store the data loaded from these files in memory to reduce the number of reads from disk.
All of the requests will be asking for the same data, so it makes sense to have a single cache of in-memory data which is accessible to all requests.
What is the best way to create a single accessible object instance which I can use to store and access this cached data? I've looked into HttpApplication, but apparently a new instance of this is created for parallel requests and so it doesn't fit my needs.