Open salokanto opened 7 years ago
SET arguments, as per Redis documentation, are:
SET
SET key value [EX seconds] [PX milliseconds] [NX|XX]
This means that NX or XX is optional, but current the implementation forces you to pick either:
NX
XX
def set(key: Any, value: Any, onlyIfExists: Boolean, time: SecondsOrMillis): Boolean = { val nxxx = if (onlyIfExists) "XX" else "NX" val expx = time match { case Seconds(v) => List("EX", v) case Millis(v) => List("PX", v) } send("SET", List(key, value, nxxx) ++ expx)(asBoolean) }
Users typically want the default behavior (overwrite if exists), which is neither NX nor XX.
And while at it, it would be nicer to use scala.concurrent.duration.Duration instead of the custom-made one (SecondsOrMillis).
scala.concurrent.duration.Duration
SecondsOrMillis
SET
arguments, as per Redis documentation, are:This means that
NX
orXX
is optional, but current the implementation forces you to pick either:Users typically want the default behavior (overwrite if exists), which is neither NX nor XX.
And while at it, it would be nicer to use
scala.concurrent.duration.Duration
instead of the custom-made one (SecondsOrMillis
).