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

Issue #59 : Add SetNx (Set if not exist) method to cache #82

Closed
wants to merge 2 commits into from
Closed

Issue #59 : Add SetNx (Set if not exist) method to cache #82

wants to merge 2 commits into from

Conversation

@patrickmn
Copy link
Owner

Thanks, but looking at the "examples" in the test case, this feels too weird in this language. I don't think the overhead of those type signatures are worth it. There's already too much empty interface and type-assertion overhead in this library.

@krarjun90
Copy link

@patrickmn ok i agree the examples in test cases doesn't tell you the real need of this. Let's say you have a function to fetch the data from database and then cache the data for few mins.

So SetNx will help in checking if the data exist, and if not call the function, get the data, set it and return.

@krarjun90
Copy link

@patrickmn Also SetNx is something which is available across many libraries.

https://godoc.org/github.com/go-redis/redis#Client.SetNX
https://redis.io/commands/setnx

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

Successfully merging this pull request may close these issues.

None yet

3 participants