I have data in this format:
student_id:{ course: math
day: sunday
time: 16:00
},
{ course: physics,
day: friday,
time: 20:00
}
Could I store it in redis? One key and multiple structs!
I have data in this format:
student_id:{ course: math
day: sunday
time: 16:00
},
{ course: physics,
day: friday,
time: 20:00
}
Could I store it in redis? One key and multiple structs!
2
Answers
There are couple options for you:
Simple String value which use JSON string: Dump your data structure to Json and you can use any structures for value.
List / SortedSet / Hash: for multiple records, you can use list(or sorted set for range query). Or you can use hash for k-v dict as your value.
The concept I think you’re looking to learn about is called serialization. Serialization is the process of converting an object in your program into a binary string, a sequence of zeros and ones. This binary string can then be saved into a redis key.
There are a number of serialzation protocols that you can use. Some examples:
etc.