MCPcopy Create free account
hub / github.com/encoder-run/operator / SetIndex

Method SetIndex

pkg/cache/redis/index.go:20–29  ·  view source on GitHub ↗

SetIndex serializes and stores the index in Redis.

(idx *index.Index)

Source from the content-addressed store, hash-verified

18
19// SetIndex serializes and stores the index in Redis.
20func (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.
32func (s *IndexStorage) Index() (*index.Index, error) {

Callers

nothing calls this directly

Calls 1

withNamespaceFunction · 0.85

Tested by

no test coverage detected