Inserting a List into another List in Redis

后端 未结 3 413
灰色年华
灰色年华 2021-01-12 07:23

Is this possible to have a datastructure inside another data structure? So far I can only insert a string or a number into a list.

A desired data structure would be

3条回答
  •  执笔经年
    2021-01-12 07:43

    Simple answer: No, Redis list members can only be strings.

    Complex answer: There is a lot you can do with strings. You can serialize a list into a string using a number of different formats (JSON, XML, CSV, language specific serialization, etc.). Redis can hold pretty large string values so you can store just identifiers which point to a key containing the real values, or you can have a serialized list of the values themselves.

提交回复
热议问题