In my application, I need a 'dictionary' which
(1) is able to hold a lot of key value pairs
(2) is able to persist part of the elements to files or isolated storage because there are too much data to store in memory
(3) no key-value pair is allowed to 开发者_如何学运维expire or be removed (unless I do that explicitly)
Can I use Cache Application Block in my scenario? Or is there any other library to recommend?
Thanks,
You can do this with Enterprise Library. Note you will loose all your cache if the application pool is recycled, so you need to configure/program your cache with a backing store so that it gets values from disk if they are not available in memory.
We have used Entlib caching on many projects over the years. Recently we have move to the newer Appfabric Caching, see: http://msdn.microsoft.com/en-us/library/ff383731.aspx
For new projects I would recommend Appfabric caching.
The Entlib caching block keeps a copy of everything in memory as well as persisting to the backing store. So it will not be suitable for #2 in your list above.
精彩评论