SetIndex serializes and stores the index in Redis.
(idx *index.Index)
| 18 | |
| 19 | // SetIndex serializes and stores the index in Redis. |
| 20 | func (s *IndexStorage) SetIndex(idx *index.Index) error { |
| 21 | data, err := json.Marshal(idx) |
| 22 | if err != nil { |
| 23 | return err |
| 24 | } |
| 25 | |
| 26 | // Assuming "index" is the key where the index is stored. |
| 27 | // You might want to use a more specific key based on your application's needs. |
| 28 | return s.client.Set(ctx, withNamespace(s.namespacePrefix, indexPrefix, ""), data, 0).Err() |
| 29 | } |
| 30 | |
| 31 | // Index retrieves and deserializes the index from Redis. |
| 32 | func (s *IndexStorage) Index() (*index.Index, error) { |
nothing calls this directly
no test coverage detected