2

I need to find the best implementation to send a byte array to the key space of a Redis Server with Booksleeve.

I tried different implementation like UTF8 Encoding but i don't know what is the most optimized one in memory of redis server (i will worked with millions of key like this so i really need the shortest in memory key).

Is anyone has already had this requirement?

baz
  • 151
  • 1
  • 9
  • Redis supports binary data. You don't need to encode anything to send a byte array to Redis. – Didier Spezia Apr 26 '13 at 16:36
  • I have noticed that we could send binary in value but i don't find any method to send a key in binary with booksleeve wrapper. – baz Apr 26 '13 at 16:47

1 Answers1

1

In the current build for simplicity I've stuck to string keys, however the code would handle binary fine - it uses the binary API. IIRC I received a patch in my inbox just this week that adds binary key support.

Since it seems to be in demand I'll look at that this week.


Edit: a week came and went; the reason being that I'm also doing some work on redis-cluster support, which is going to need some new interfaces anyway, because:

  • not all operations are supported
  • parallel (numbered) databases aren't supported

So basically my plan is to roll both pieces of work into the same branch, giving:

  • a new set of interfaces
    • which use a struct for the key parameter with an implicit conversion operator from string and byte, allowing either to be used interchangeably
    • with the redis-cluster and redis-server commands on separate APIs
    • and a new method on the old connection to get one of the new APIs on a per-DB basis, i.e. Database(3).Keys.Remove(key); or something like that

ETA is still imaginary, but I wanted to explain why I hadn't simply thrown in the existing patch - I think the advent of redis-cluster makes it a good time to revisit the entire API, (but obviously in a way that doesn't break existing code).

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Glad that you can work on this feature. Would you have an approximate date of this dev? Anyway, thank you for your great lib – baz May 25 '13 at 13:50
  • Thanks for the answer, i will test your api as soon as it will be release on nuget. – baz May 30 '13 at 17:23
  • I use your api in production since this week and it work exactly that i would expected, great job! – baz May 30 '13 at 17:35