Closed minhncud closed 5 years ago
Maybe I don't understand your question, but it looks like you need to store a JSON string on each hash field?
Nothing stops you to do that as long as your class is serializable/deseralizable under the serialization method used.
The values are serialized when storing them on the Redis hash fields,
Edit: My bad, i think much about RedisDictionary and forgot context.Cache.GetHashedAll. Thank you very much and you don't need read below.
This sample is easier to read
If i only have first 3 fields, i can use context.Collections.GetRedisDictionary<string, Fruit>("HashObjects") to add or get values in Fruit object
But in this photo, if i use context.Collections.GetRedisDictionary<string, Fruit>("HashObjects") to get Fruit values and context.Collections.GetRedisDictionary<string, Cake>("HashObjects") to get Cake values, it returns nothing.
I want to store both Fruit and Cake in Food like this:
About serialization between Object and Json, do you mean using string as context.Collections.GetRedisDictionary<string, string>("HashObjects") ?
Me again, i'm sorry but i have a question. Simple, we have context.Collections.GetRedisDictionary<type, T>("hashkey") to take a hashkey in Redis. But if i have a class: class MultiObject { List list1 { get; set; }
List list2 { get; set; }
List list3 { get; set; }
}
Can i get or set to a hashkey like that:
It uses to store lists of multiple type objects which have 1~5 records each type. Thank you.