setListToDB stores the data into the database.
(key string, lst *list, ttl time.Duration)
| 610 | |
| 611 | // setListToDB stores the data into the database. |
| 612 | func (l *ListStructure) setListToDB(key string, lst *list, ttl time.Duration) error { |
| 613 | // Serialize into binary array |
| 614 | encValue, err := l.encodeList(lst, ttl) |
| 615 | if err != nil { |
| 616 | return err |
| 617 | } |
| 618 | // Store in the database |
| 619 | return l.db.Put([]byte(key), encValue) |
| 620 | } |
| 621 | |
| 622 | // encodeList encodes the value |
| 623 | // format: [type][data] |