I have a web application that pulls data from template files on the hard-disk of the server. There are about 30-40 different .html files there that it accesses.

I want to cache the data so that I don't have to keep reading and reading the data over and over.
This is my function

VB Code:
  1. Public Function strGetFile(ByVal strFilePath As String, ByVal Server As HttpServerUtility, ByRef State As HttpApplicationState) As String
  2.         If State.Get(strFilePath) = vbNullString Then
  3.             Dim objStreamReader As StreamReader = File.OpenText(Server.MapPath(strFilePath))
  4.             Dim strRetVal As String = objStreamReader.ReadToEnd()
  5.             objStreamReader.Close()
  6.             State.Add(strFilePath, strRetVal)
  7.             Return strRetVal
  8.         Else
  9.             Return State.Get(strFilePath)
  10.         End If
  11.     End Function

Previously I just passed in the file path and the Server object (so that I can use MapPath (this code is in a module)).
But now I'm trying to cache the information. I've read up on the ApplicationState class, but it doesn't seem to be remembering the contents of the files. In fact, it seems more Stateless than Stateful....