I want to use the MessagePack
, ZeroFormatter
or protobuf-net
to serialize/deserialize a generic list and store it in Redis using the stackexchange.redis
client.
Now I'm storing a JSON string with the StringSetAsync()
method. But I can't find any documentation on how to store a byte[]
in Redis.
StackExchange.Redis
usesRedisValue
to represent different types of values stored in Redis and so it provides implicit conversion operators (forbyte[]
among others). Please read StackExchange.Redis / Basic Usage / Values carefully as in the third sentence of that chapter you can findwhich basically means that you can use
IDatabase.StringSet()
to store a basic value (which Redis generally thinks of as a "string" as there are other types like sets, hashes, and so on) - be it string or an array of bytes.