This project was moved.
Project DescriptionObject-Hash Mapper for Redis and BookSleeve.
Description
This is
BookSleeve based Redis Object Hash mapper. Fully integrated C# 5.0 async.
Usage
using (var conn = new RedisConnection("localhost"))
{
await conn.Open();
// Create mapper, Key is "MyClass:10"
var mapper = new HashMapper<MyClass>(conn, id: 10);
// Store object
await mapper.Set(new MyClass { IntProp = 100, StrProp = "Hoge" });
// Get from Redis
var value = await mapper.Get();
// Get field(TypeSafe selector)
var strProp = await mapper.GetField(x => x.StrProp);
// Atomic increment
await mapper.Increment(x => x.IntProp, 50);
// Remove object
await mapper.Remove();
}
public class MyClass
{
public int IntProp { get; set; }
public string StrProp { get; set; }
}
Serialize with protobuf-net
You can serialize with
protobuf-net
// custom config, can select serializer
var config = new HashMapperConfig(
db: 0,
keyPrefix: "",
serializeProviderFactory: () => new ProtobufSerializeProvider());
var mapper = new HashMapper<MyClass>(conn, id: 10, config: config);