storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an is responsible for managing our storage.

func New

func New(
	cache Implementation,
	errorChan chan error,
	queries chan common.PropertyQuery,
	results chan common.PropertyResponse,
	wg *sync.WaitGroup,
	waitForMissing bool,
) (*Client, error)

func (*Client) Get

func (*Client) Metrics

func (s *Client) Metrics() *ristretto.Metrics

func (*Client) StartListening

func (s *Client) StartListening(ctx context.Context)

type Implementation

type Implementation interface {
	// cache io
	Get(key string) (common.PropertyResponse, bool)
	SetWithTTL(key string, value common.PropertyResponse, cost int64, ttl time.Duration) bool

	// for metrics
	Metrics() *ristretto.Metrics
}

type Ristretto

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

func NewStorageImplementation

func NewStorageImplementation(
	numberOfCounters int64,
	maxCost int64,
	bufferItems int64,
) (*Ristretto, error)

func (*Ristretto) Get

func (r *Ristretto) Get(key string) (common.PropertyResponse, bool)

func (*Ristretto) Metrics

func (r *Ristretto) Metrics() *ristretto.Metrics

func (*Ristretto) SetWithTTL

func (r *Ristretto) SetWithTTL(key string, value common.PropertyResponse, cost int64, ttl time.Duration) bool

Jump to

Keyboard shortcuts

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