vapor / redis

Vapor provider for RediStack
MIT License
459 stars 58 forks source link

SADD Integer Rejection #127

Closed Mordil closed 5 years ago

Mordil commented 5 years ago

When executing the SADD command with a RedisData(integerLiteral:) Redis throws the error: ERR Protocol error: expected '$', got ':'

The rejected stream input: "*3\r\n$9\r\nSISMEMBER\r\n$30\r\nGSAPI_GEOFENCING_ON_SITE_COUNT\r\n:31\r\n"

If I use RedisData(stringLiteral:) instead, Redis accepts the stream.

Accepted stream input:: "*3\r\n$9\r\nSISMEMBER\r\n$30\r\nGSAPI_GEOFENCING_ON_SITE_COUNT\r\n$2\r\n31\r\n"

vzsg commented 5 years ago

That's actually normal. Redis stores expects the members as strings, even if they were to represent numbers in the end.

Mordil commented 5 years ago

So is it expected that users of the package don't try to store integers as such, and should send it as RedisData(bulk:) or RedisData(stringLiteral:)?

John-Connolly commented 5 years ago

All Redis commands need to be sent as BulkStrings

Mordil commented 5 years ago

Most cases of learning this will be solved with #131 being merged.