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 #204 - Redis Get response in case of missing value #238
Conversation
* Handle err == redis.Nil as a cache miss instead of an error Signed-off-by: George Christou <christgf@gmail.com>
* Happy path should be last statement Signed-off-by: George Christou <christgf@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks very much for the contribution.
Codecov Report
@@ Coverage Diff @@
## master #238 +/- ##
=======================================
Coverage 73.01% 73.01%
=======================================
Files 57 57
Lines 3332 3332
=======================================
Hits 2433 2433
Misses 837 837
Partials 62 62 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking the time to open your first PR in Patron!
It looks good, just one remark; I think that we can remove this const Nil = redis.Nil
as well.
It was used to export the redis.Nil
error so that the end-user could implement the cache miss check herself, but this is no longer necessary!
Actually @tpaschalis, it seems that this still serves its original purpose, and removing it would require we import redis/v7 in the Redis cache implementation (which is where the redis.Nil check is needed). |
On the other hand, you're right, let's keep the imports tidied up! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!!!
…tlabs#238) Signed-off-by: George Christou <christgf@gmail.com>
Signed-off-by: George Christou christgf@gmail.com
Which problem is this PR solving?
Resolves #204 - Redis Get response in case of missing value
Short description of the changes
When returning results from Redis, an empty cache key is handled as an error, which is inconsistent with the caching API interface. The change ensures cache misses don't result in errors, as proposed.
Please note there's currently no test fixture for the Redis cache implementation.