go-cache
go-cache copied to clipboard
The efficiency of `Get` will decrease if too many `Set ` are executed
It's caused by the RWLock for the thread-safe. How about using sync.Map? It can increase the efficiency of Get.
I don't think sync.Map would be a good default choice. Caches are gerenally read more freaquently that written to.
I would suggest sending your cache updates to a channel and recieving from it on a different goroutine in a loop (select with timeout) and updating the cache.