cache icon indicating copy to clipboard operation
cache copied to clipboard

Is it safe to use it with concurrency?

Open HectorMRC opened this issue 2 years ago • 4 comments

I want to use this cache in a concurrent system, should I declare a Mutex for managing simultaneously read/write operations, or can I use it safely without it?

HectorMRC avatar Jun 02 '22 16:06 HectorMRC

Same concern, while reading the code I saw it is not thread-safe. But need the confirmation from the dev team. At the moment I init the cache instance per request.

QuanTran91 avatar Oct 20 '22 07:10 QuanTran91

It looks to me as though the cache is safe to run in a concurrent system. Instead of relying directly on channels or mutex, it seems to use singleflight.Group. The Once() function in particular is a clever way of handling duplicate requests of the same key in parallel--I'm looking forward to trying this library since it's already got code I thought I'd have to write . . .

NathanBak avatar Nov 18 '22 03:11 NathanBak

Has anyone found out whether this is concurrency safe yet?

codylittle avatar Jul 07 '23 09:07 codylittle

Same situation. I would love to here a reply from the dev team.

aliml92 avatar Apr 01 '24 23:04 aliml92