storecache

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2019 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexCache

type IndexCache struct {
	// contains filtered or unexported fields
}

func NewIndexCache

func NewIndexCache(logger log.Logger, reg prometheus.Registerer, opts Opts) (*IndexCache, error)

NewIndexCache creates a new thread-safe LRU cache for index entries and ensures the total cache size approximately does not exceed maxBytes.

func (*IndexCache) Postings

func (c *IndexCache) Postings(b ulid.ULID, l labels.Label) ([]byte, bool)

func (*IndexCache) Series

func (c *IndexCache) Series(b ulid.ULID, id uint64) ([]byte, bool)

func (*IndexCache) SetPostings

func (c *IndexCache) SetPostings(b ulid.ULID, l labels.Label, v []byte)

SetPostings sets the postings identfied by the ulid and label to the value v, if the postings already exists in the cache it is not mutated.

func (*IndexCache) SetSeries

func (c *IndexCache) SetSeries(b ulid.ULID, id uint64, v []byte)

SetSeries sets the series identfied by the ulid and id to the value v, if the series already exists in the cache it is not mutated.

type Opts

type Opts struct {
	// MaxSizeBytes represents overall maximum number of bytes cache can contain.
	MaxSizeBytes uint64
	// MaxItemSizeBytes represents maximum size of single item.
	MaxItemSizeBytes uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL