0

I'm trying to answer these questions about dataType in redis as it becomes so confusing for me.

  1. if I want to store a string data or List<string> data in redis ,what would be the real format of data stored in Redis ?
  2. What would be considered as Set in Redis ? what kind of data structure in c# consider as Set and can be stored there?
  3. What's is different between redisClient.Set() and redisClient.SAdd() from IRedisNativeClient Interface in ServiceStack and for what kind of dataType I should use them ?

Thanks

Simon
  • 71
  • 1
  • 1
  • 6

1 Answers1

0

1 - A string data differs from a List, a string is a list of char a List is a list of strings. If you want to store strings use Redis "STRING" (or "HASH", if you want an HASHMAP), if you want to store a list of strings use a Redis LIST.

2 - You are looking for HashSet.

3 - See set and sadd:

void Set(string key, byte[] value); // (STRING op) set a string "value" at the key "key".
void SAdd(string setId, byte[] value); // (SET op) add a "value" into the set "setId".
Community
  • 1
  • 1
FGRibreau
  • 7,021
  • 2
  • 39
  • 48