2

So using lists within Servicestack/Redis, when pulling them back from the server I am getting a list of strings (which each the same CLASS just different data in each one).

I did not see a way of using "typed" lists which would allow Servicestack to serialize/deserialize as I add, get items from the List. So my question is:

List<string> resp = rc.GetAllItemsFromList (key);

Gives me back a LIST (Collection) of strings. Each one being a JSON representation of Class ABC.

I'd rather have a list of <ABC> returned. If not, I know I can iterate through the collection of strings deserializing each. But want to know if there is a better way to be doing this than that.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Shawn L
  • 21
  • 1

1 Answers1

1

To get a List of Types back you'd use the IRedisTypedClient API and access the Typed List APIs in IRedisList by accessing the Lists[] collection, e.g:

var redisAbc = redis.As<Abc>();
List<Abc> results = redisAbc.Lists[key].GetAll();
mythz
  • 141,670
  • 29
  • 246
  • 390