5

I am new to both Redis and BookSleeve. I am evaluating whether I should use BookSleeve or ServiceStack.Redis.

ServiceStack seems much more staightforward but I like the idea of pipelining provided by BookSleeve.

I have Redis and BookSleeve running and getting and setting strings is a snap but I'm struggling to find examples of setting and getting a collection of objects such as my pocos.

public class MyType
{
....
}

IEnumerable<MyType> types = ....

How do I get and set these using BookSleeve?

Thanks.

ChrisS
  • 2,595
  • 3
  • 18
  • 19

2 Answers2

5

BookSleeve exposes APIs to read/write strings and blobs (byte[]), but it does not force you down any particular serialization route, or dictate whether a collection should be stored as a single value, vs a list, etc.

Basically, with BookSleeve you would serialize separately, via any serializer that you fancy (XML, json, protobuf, whatever), and send that. This is usually only about 2 or 3 lines of code (often involving MemoryStream).

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • I see... I was hoping it would offer a little more refinement than that. – ChrisS Jan 27 '13 at 14:09
  • 3
    @Refinement that is like saying a coffee machine isn't refined because it doesn't keep your lettuce cold :) it isn't a serialization lib... – Marc Gravell Jan 27 '13 at 20:45
1

When using ServiceStack.Redis it's just a matter of:

var redisClient = new RedisClient();
redisClient.StoreAll(myTypes);

Not sure what pipelining features you're looking for but you can create custom pipelined operations with ServiceStack.Redis's transactions API (which are always pipelined) or if you don't want the operations to execute within a transaction you can use Redis.CreatePipeline() - see these tests for some examples.

mythz
  • 141,670
  • 29
  • 246
  • 390
  • Thank you. Now I know why there are more examples in the wild with ServiceStack.Redis and why it seems to be more widely adopted. I think it is a better fit for what I want to do. – ChrisS Jan 27 '13 at 14:11