Closed bdbai closed 5 years ago
That is what the lib did previously, but it leads to sharing the object between multiple goroutines which causes nasty bugs if object is modified. You probably need to create a specialized cache just for your use case.
Since the object is never modified, it possible to add a option to accomplish this?
It should be possible. Do you care to send a PR?
I am working on tests. Once it's done I will send a PR :)
I prefer not to fix this. If you need better performance - use sync.Map or write something that works for your use case.
We have a Go program consisting of hundreds of goroutines and they all need to access the same Redis cache key. Then the bytes in local cache is unmarshalled over and over again.
How about storing the unmarshalled object in the local cache?