Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it safe to use it with concurrency? #83

Open
HectorMRC opened this issue Jun 2, 2022 · 4 comments
Open

Is it safe to use it with concurrency? #83

HectorMRC opened this issue Jun 2, 2022 · 4 comments

Comments

@HectorMRC
Copy link

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?

@QuanTran91
Copy link

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.

@NathanBak
Copy link

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 . . .

@codylittle
Copy link

Has anyone found out whether this is concurrency safe yet?

@aliml92
Copy link

aliml92 commented Apr 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants