Minimum threaded lock hash table?

Are there any Hashtable implementations available that provide thread safety with minimal blocking in .NET? Or in another language that can be ported to .NET?

We are looking for a cross between using the BCL Dictionary <,> class with locking () and a distributed caching application such as memcached or Velocity.

The intended use for a cache with thousands of readers reading immutable values ​​based on keys (either numbers or indications, we have not decided yet). There will be far fewer writers, perhaps just one.

+6
multithreading c # data-structures locking
source share
2 answers

Starting with .Net 4.0, ConcurrentDictionary . This is a hash table style structure designed for high-performance use between multiple threads.

Details on use and implementation can be found here:

+4
source share

Q What is the best way to implement a thread safe dictionary? Brian Rudolph shares a link to a threadlike dictionary that uses ReaderWriterLockSlim: http://devplanet.com/blogs/brianr/archive/2008/09/26/thread-safe-dictionary-in-net.aspx .

You can also see the Synchronized Hashtable: http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx .

+1
source share

All Articles