etaty / rediscala

Non-blocking, Reactive Redis driver for Scala (with Sentinel support)
Apache License 2.0
790 stars 142 forks source link

Add binary-safe alternatives for eval #183

Open mspielberg opened 7 years ago

mspielberg commented 7 years ago

Currently the only externally accessible commands for EVAL and friends take Seq[String] for keys and arguments. String can only contain valid UTF-8 sequences, which makes it impossible to send arbitrary binary data to a Lua script, for example to do a compare-and-set of compressed data.

This exposes a new evalBinary method and related equivalents that expose the ability for an application to provide its own ByteStringSerializer instances for arguments to scripts. Note these can't easily be written as simple overloads because the erased type of the arguments (Seq[_]) would be identical to the existing Seq[String] methods.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.02%) to 90.735% when pulling de389243cc356bcc048cc210a0b72319f715abb0 on mspielberg:master into 55573df26adbe20be54291ffc67414af028bf889 on etaty:master.

btd commented 7 years ago

Ping @etaty .This PR very useful, i hit exactly the same limitation.