Remove Redis.exists warning#46
Merged
claudioprocore merged 1 commit intoprocore-oss:masterfrom Jun 10, 2021
Merged
Conversation
bpross
approved these changes
Jun 10, 2021
|
Can you add a comment to the changelog? |
This commit removes the following warning when using the gem > `Redis#exists(key)` will return an Integer in redis-rb 4.3. `exists?` > returns a boolean, you should use it instead. To opt-in to the new behavior > now you can set Redis.exists_returns_integer = true. To disable this message > and keep the current (boolean) behaviour of 'exists' you can set > `Redis.exists_returns_integer = false`, but this option will be removed in 5.0.
852777d to
6898921
Compare
bpross
approved these changes
Jun 10, 2021
Contributor
Author
|
@bpross Thanks! Can you ping me when a new version of this gem is released? |
|
@claudioprocore will do. Once this is approved: #45 we will be pushing out a new release. |
kkohrt
reviewed
Dec 8, 2023
|
|
||
| def fetch | ||
| return unless redis.exists(redis_key) | ||
| return unless redis.exists?(redis_key) |
There was a problem hiding this comment.
You could bypass the issue and instead of hitting redis with an exists followed by a get (which returns nil if the key is not present, just ask for it.
json_token = redis.get(redis_key) || return
token = JSON.parse(json_token)
...
or
json_token = redis.get(redis_key)
return if json_token.nil?
token = JSON.parse(json_token)
...
whichever feels cleaner to you
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit removes the following warning when using the gem