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

singleflight: add OnceGroup struct #96

Open
kevinburke opened this issue May 12, 2018 · 0 comments
Open

singleflight: add OnceGroup struct #96

kevinburke opened this issue May 12, 2018 · 0 comments

Comments

@kevinburke
Copy link
Contributor

kevinburke commented May 12, 2018

OnceGroup.Do would have the same semantics as Group.Do, but caches and returns the first computed result.

Example: looking up the user id in /etc/passwd for a given username; something you might need to do once and not more than that, since (if) you don't expect the value to change during the life of the process.

@kevinburke kevinburke changed the title singleflight: add DoOnce function singleflight: add OnceGroup struct May 13, 2018
kevinburke added a commit to kevinburke/groupcache that referenced this issue May 13, 2018
OnceGroup.Do has the same semantics as Group.Do, but caches and
returns the first computed result if called sequentially.

Fixes golang#96.
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

1 participant