-
Notifications
You must be signed in to change notification settings - Fork 43
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
#256 support redis zset #258
Conversation
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 your contribution, very nice PR! Awesome work. Would you mind looking at my comments? They are very minor. I'll merge it then.
} | ||
|
||
def isEmpty = { | ||
redis.zsetSize(key).map(_ == 0).recoverWithDefault(true) |
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.
redis.zsetSize(key).map(_ == 0).recoverWithDefault(true) | |
size.map(_ == 0) |
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.
I've tried with the compiler, it turned out that can't use map
here cause the impact of recoverWithDefault
. I checked out the implementation for set
and hash
, the code style is the same.
def size = {
redis.setSize(key).recoverWithDefault(0)
}
def isEmpty = {
redis.setSize(key).map(_ == 0).recoverWithDefault(true)
}
def nonEmpty = {
redis.setSize(key).map(_ > 0).recoverWithDefault(false)
}
src/main/scala/play/api/cache/redis/connector/RedisConnectorImpl.scala
Outdated
Show resolved
Hide resolved
Hi @KarelCemus, your suggestion is reasonable, i have checked it out and optimize the code. Please check it again. |
I've added test cases, but the coverage still report errors. It's strange that it didn't report errors when i commit code first time on PR. |
Thank you for your contribution, I am closing this PR since I don't have write access to your branch and creating #259 instead. I added multiple tests to fix the coverage and did some minor refactoring and addressed the comments here. |
This PR support basic commands of Redis zset. For now, just only support
ZADD
,ZREM
,ZCARD
,ZRANGE
,ZREVRANGE
.