I have some fairly basic questions regarding the use of booksleeve in conjunction with protobuf-net. Now I have implemented a singleton class to manage the connections so I am reusing the same connection many times as recommended. Now I several questions regarding actual use of the combo:
- What is the difference/importance of the "db" int and the "key" string?
- How would I serialize a bunch of objects into a SortedSet/List using protobuf-net?
- How would I deserialize a bunch of objects from a SortedSet/List using protobuf-net?
I was thinking that I should use the Range() method for retrieval:
public IList<T> RetrieveAllAsList()
{
var conn = RedisConnectionManager.Current.GetConnection();
conn.Open();
int length = (int)conn.Lists.GetLength(10, "idk").Result;
byte[][] data = conn.Lists.Range(10, "idk", 0, length-1).Result;
List<T> output = new List<T>();
for (int i = 0; i < data.Length; i++)
{
using (MemoryStream ms = new MemoryStream(data[i]))
{
output.Add(Serializer.Deserialize<T>(ms));
}
}
conn.Close(false);
return output;
}
I would appreciate any help in this matter. Thank you.