Open
Conversation
4892dc4 to
b31ae8a
Compare
mijicd
reviewed
Sep 26, 2024
Comment on lines
+104
to
+107
| case class SetExpireMilliseconds(duration: Duration) extends SetExpire | ||
| case class SetExpireSeconds(duration: Duration) extends SetExpire | ||
| case class SetExpireUnixTimeMilliseconds(instant: Instant) extends SetExpire | ||
| case class SetExpireUnixTimeSeconds(instant: Instant) extends SetExpire |
Member
There was a problem hiding this comment.
Two things:
- keep case classes final
- since units are dictated by redis, I would replace
DurationandInstantwithLongand ensure they're valid
Comment on lines
+113
to
+116
| case class GetExpireMilliseconds(duration: Duration) extends GetExpire | ||
| case class GetExpireSeconds(duration: Duration) extends GetExpire | ||
| case class GetExpireUnixTimeMilliseconds(instant: Instant) extends GetExpire | ||
| case class GetExpireUnixTimeSeconds(instant: Instant) extends GetExpire |
| GetExAtInput[String]().encode( | ||
| scala.Tuple3("key", ExpiredAt.SetExpireAtSeconds, Instant.parse("2021-04-06T00:00:00Z")) | ||
| GetExInput[String]().encode( | ||
| scala.Tuple2("key", GetExpire.GetExpireUnixTimeSeconds(Instant.parse("2021-04-06T00:00:00Z"))) |
Member
There was a problem hiding this comment.
I think we can be less verbose here :)
| } yield assert(result)(equalTo(RespCommand(Key("key"), Literal("PERSIST")))) && | ||
| assert(resultWithoutOption)(equalTo(RespCommand(Key("key")))) | ||
| resultPersist <- ZIO.attempt(GetExInput[String]().encode(scala.Tuple2("key", GetExpire.Persist))) | ||
| } yield assert(resultSeconds)(equalTo(RespCommand(Key("key"), Literal("EX"), Value("1")))) && |
Member
There was a problem hiding this comment.
We should start replacing assert(...)(...) && assert(...)(...) with assertTrue(..., ..., ...)
mijicd
reviewed
Sep 27, 2024
Comment on lines
+102
to
+105
| final case class Milliseconds(milliseconds: Long) extends SetExpire | ||
| final case class Seconds(seconds: Long) extends SetExpire | ||
| final case class UnixTimeMilliseconds(milliseconds: Long) extends SetExpire | ||
| final case class UnixTimeSeconds(seconds: Instant) extends SetExpire |
Member
There was a problem hiding this comment.
I think we need to prevent negative inputs. Also, you missed one Instant
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.
Summary:
Update(XX,NX,LT,GT) toUpdate(XX,NX) andUpdateByScore(LT,GT)SETcommand only takesNX | XX(more info here)ZADDcommand takes bothNX | XXandLT | GT(more info here)Note: The GT, LT and NX options are mutually exclusive. (This has not been implemented)
setEx,setNx, andpSetExcommands because they were deprecated since version2.6.12KeepTtland durations becauseSETcommand can't take bothexpireAtandkeepTtlgetExcommands into one