github.com/thanos-io/thanos@v0.32.5/pkg/cache/cache.go (about)

     1  // Copyright (c) The Thanos Authors.
     2  // Licensed under the Apache License 2.0.
     3  
     4  package cache
     5  
     6  import (
     7  	"context"
     8  	"time"
     9  )
    10  
    11  // Generic best-effort cache.
    12  type Cache interface {
    13  	// Store data into the cache.
    14  	//
    15  	// Note that individual byte buffers may be retained by the cache!
    16  	// Cache by itself needs to support write timeouts by itself.
    17  	Store(data map[string][]byte, ttl time.Duration)
    18  
    19  	// Fetch multiple keys from cache. Returns map of input keys to data.
    20  	// If key isn't in the map, data for given key was not found.
    21  	Fetch(ctx context.Context, keys []string) map[string][]byte
    22  
    23  	Name() string
    24  }