Bob123Moon
Bob123Moon

Reputation: 167

Pre .NET 4 memory cache

I want to use the new MemoryCache class but I am not yet using .NET 4. I do have a simple cache class (internally uses a dictionary). What would be a good approach in using this class like the MemoryCache? Does anyone know how MemoryCache is managed throughout the lifetime of an application (non asp.net)?

Upvotes: 2

Views: 558

Answers (2)

Juan
Juan

Reputation: 3705

Enterprise Library had a Caching block that was similar to what .Net 4 has now on the core framework.

It was there for Version 5, but I think it has been removed from version 6. Getting an older version of the enterprise library will provide you with a caching mechanism.

Upvotes: 1

thekip
thekip

Reputation: 3768

Maybe you can use a tool like Structuremap for that? It's not really meant to do these things (it's a DI container) but it will work out well if you specify some items as a singleton, some items on a request basis etc. It just depends on how granular you want the lifetime management to be.

Upvotes: 1

Related Questions