ristretto

package module
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 8 Imported by: 14

Documentation

Overview

Package mocks is a generated GoMock package.

Index

Constants

View Source
const (
	// RistrettoType represents the storage type as a string value
	RistrettoType = "ristretto"
	// RistrettoTagPattern represents the tag pattern to be used as a key in specified storage
	RistrettoTagPattern = "gocache_tag_%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRistrettoClientInterface

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

MockRistrettoClientInterface is a mock of RistrettoClientInterface interface.

func NewMockRistrettoClientInterface

func NewMockRistrettoClientInterface(ctrl *gomock.Controller) *MockRistrettoClientInterface

NewMockRistrettoClientInterface creates a new mock instance.

func (*MockRistrettoClientInterface) Clear

func (m *MockRistrettoClientInterface) Clear()

Clear mocks base method.

func (*MockRistrettoClientInterface) Del

func (m *MockRistrettoClientInterface) Del(key any)

Del mocks base method.

func (*MockRistrettoClientInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRistrettoClientInterface) Get

func (m *MockRistrettoClientInterface) Get(key any) (any, bool)

Get mocks base method.

func (*MockRistrettoClientInterface) SetWithTTL

func (m *MockRistrettoClientInterface) SetWithTTL(key, value any, cost int64, ttl time.Duration) bool

SetWithTTL mocks base method.

type MockRistrettoClientInterfaceMockRecorder

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

MockRistrettoClientInterfaceMockRecorder is the mock recorder for MockRistrettoClientInterface.

func (*MockRistrettoClientInterfaceMockRecorder) Clear

Clear indicates an expected call of Clear.

func (*MockRistrettoClientInterfaceMockRecorder) Del

func (mr *MockRistrettoClientInterfaceMockRecorder) Del(key interface{}) *gomock.Call

Del indicates an expected call of Del.

func (*MockRistrettoClientInterfaceMockRecorder) Get

func (mr *MockRistrettoClientInterfaceMockRecorder) Get(key interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockRistrettoClientInterfaceMockRecorder) SetWithTTL

func (mr *MockRistrettoClientInterfaceMockRecorder) SetWithTTL(key, value, cost, ttl interface{}) *gomock.Call

SetWithTTL indicates an expected call of SetWithTTL.

type RistrettoClientInterface

type RistrettoClientInterface interface {
	Get(key any) (any, bool)
	SetWithTTL(key, value any, cost int64, ttl time.Duration) bool
	Del(key any)
	Clear()
}

RistrettoClientInterface represents a dgraph-io/ristretto client

type RistrettoStore

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

RistrettoStore is a store for Ristretto (memory) library

func NewRistretto

func NewRistretto(client RistrettoClientInterface, options ...lib_store.Option) *RistrettoStore

NewRistretto creates a new store to Ristretto (memory) library instance

func (*RistrettoStore) Clear

func (s *RistrettoStore) Clear(_ context.Context) error

Clear resets all data in the store

func (*RistrettoStore) Delete

func (s *RistrettoStore) Delete(_ context.Context, key any) error

Delete removes data in Ristretto memory cache for given key identifier

func (*RistrettoStore) Get

func (s *RistrettoStore) Get(_ context.Context, key any) (any, error)

Get returns data stored from a given key

func (*RistrettoStore) GetType

func (s *RistrettoStore) GetType() string

GetType returns the store type

func (*RistrettoStore) GetWithTTL

func (s *RistrettoStore) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)

GetWithTTL returns data stored from a given key and its corresponding TTL

func (*RistrettoStore) Invalidate

func (s *RistrettoStore) Invalidate(ctx context.Context, options ...lib_store.InvalidateOption) error

Invalidate invalidates some cache data in Redis for given options

func (*RistrettoStore) Set

func (s *RistrettoStore) Set(ctx context.Context, key any, value any, options ...lib_store.Option) error

Set defines data in Ristretto memory cache for given key identifier

Jump to

Keyboard shortcuts

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