skip to Main Content

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


  1. There are couple options for you:

    1. Simple String value which use JSON string: Dump your data structure to Json and you can use any structures for value.

    2. 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.

    Login or Signup to reply.
  2. 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:

    1. json
    2. protocol buffers
    3. parquet
    4. hd5
    5. msgbpack

    etc.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search