Key-Value-Polyglot
Key-Value-Polyglot copied to clipboard
Protect map with a mutex
Go maps are not safe to mutate concurrent with other mutations or reads.
Thanks! None of the version are thread safe, and I agree they should be. My tests never used more than one thread, so performance results shouldn't change. I'll merge this when I do the other two versions.
Hah, you beat me to it. Here's another approach that wraps the cache map in a thread-safe container: https://github.com/jbarham/Key-Value-Polyglot/blob/master/memg.go