Emergent Design Emergent Design Atom Github

Objects in space

8 March 2013

BookSleeve is a rather nice C# redis library that provides easy access to all of the standard redis functions. Because it aims to have an almost one-to-one mapping with the available redis commands it does not contain any higher-level functionality and therefore, if you wish to store an object, you must serialise it manually.

To simplify this process in our own projects we produced BookStack which is a small library that sits alongside BookSleeve and provides a few object-specific extension functions.

Why not ServiceStack.Redis?

We make extensive use of ServiceStack in some of our applications and therefore the ServiceStack.Redis client should have been the obvious choice, however there are problems in its implementation of the asynchronous pub/sub features that made parts of our code feel somewhat messy:

On the other hand, BookSleeve supports asynchronous unsubscription and throws an exception when the connection is broken.

What does BookStack do?

Primarily BookStack helps to store objects and maintain a set of IDs for each type which makes it simple to query for all objects of a given type.

It also provides helpers for storing lists of objects and a utility function for incremental ID generation.

ServiceStack.Text is still the fastest JSON serialiser available for C# and is therefore used by BookSleeve to stringify objects for storage in redis.

Full details about BookStack including documentation can be found on github.

Credit where it’s due