Simple C# ASP.NET Cache Implementation

前端 未结 3 1540
面向向阳花
面向向阳花 2020-12-17 01:29

I need to build up a List and cache the list and be able to append to it. I also need to be able to blow it away easily and recreate it. What is
3条回答
  •  不知归路
    2020-12-17 02:07

    The caching parts of "Tracing and Caching Provider Wrappers for Entity Framework", while not simple, are still a pretty good review of some useful things to think about with caching.

    Specifically, the two classes InMemoryCache and AspNetCache and their associated tests:

    • ICache
    • InMemoryCache and tests
    • AspNetCache

    Similar to what the question did, you could wrap HttpRuntime.Cache or HttpContext.Current.Items or HttpContext.Current.Cache in an implementation of ICache.

提交回复
热议问题