This documentation is archived and is not being maintained.

BlobCache Sample: Generic Memory Caching 

Download sample

Demonstrates the use of the CBlobCache class from within an ATL Server application.

The BlobCache sample presents a Web page featuring a text input field that accepts numbers from 1 to 100. Entering a number and pressing the Lookup button causes the page to submit the value to the application DLL, which then uses the number as the key for a data item in an in-memory cache. If the cache contains an entry to the given number, the cached value corresponding to the key is returned; otherwise the number is used as an index into a data file containing strings. Regardless of how it was retrieved, the resulting value is displayed in the HTTP response, along with a message indicating whether the retrieved string had been cached.

This sample demonstrates:

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.


  • IIS

Building and Running the Sample

To build and run this sample

  1. Open the solution file, BlobCache.sln, in the Visual Studio development environment.

  2. Build the solution. This will also deploy the solution to the local Web server.

  3. Use a Web browser to view http://localhost/blobcache/blobcache.srf.

  4. Enter a numeric value between 1 and 100 and click the Lookup button. See how varying or repeating requests for items affects the cache statistics displayed on the page.


See Also