store

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT, MIT Imports: 6 Imported by: 2

Documentation

Overview

Package store is a generated GoMock package.

Index

Constants

View Source
const NOT_FOUND_ERR string = "value not found in store"

Variables

This section is empty.

Functions

func NotFoundWithCause

func NotFoundWithCause(e error) error

Types

type InvalidateOption

type InvalidateOption func(o *InvalidateOptions)

InvalidateOption represents a cache invalidation function.

func WithInvalidateTags

func WithInvalidateTags(tags []string) InvalidateOption

WithInvalidateTags allows setting the invalidate tags.

type InvalidateOptions

type InvalidateOptions struct {
	Tags []string
}

func ApplyInvalidateOptions

func ApplyInvalidateOptions(opts ...InvalidateOption) *InvalidateOptions

func ApplyInvalidateOptionsWithDefault

func ApplyInvalidateOptionsWithDefault(defaultOptions *InvalidateOptions, opts ...InvalidateOption) *InvalidateOptions

type InvalidateOptionsMatcher

type InvalidateOptionsMatcher struct {
	Tags []string
}

func (InvalidateOptionsMatcher) Matches

func (m InvalidateOptionsMatcher) Matches(x interface{}) bool

func (InvalidateOptionsMatcher) String

func (m InvalidateOptionsMatcher) String() string

type MockStoreInterface

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

MockStoreInterface is a mock of StoreInterface interface.

func NewMockStoreInterface

func NewMockStoreInterface(ctrl *gomock.Controller) *MockStoreInterface

NewMockStoreInterface creates a new mock instance.

func (*MockStoreInterface) Clear

func (m *MockStoreInterface) Clear(ctx context.Context) error

Clear mocks base method.

func (*MockStoreInterface) Delete

func (m *MockStoreInterface) Delete(ctx context.Context, key any) error

Delete mocks base method.

func (*MockStoreInterface) EXPECT

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

func (*MockStoreInterface) Get

func (m *MockStoreInterface) Get(ctx context.Context, key any) (any, error)

Get mocks base method.

func (*MockStoreInterface) GetType

func (m *MockStoreInterface) GetType() string

GetType mocks base method.

func (*MockStoreInterface) GetWithTTL

func (m *MockStoreInterface) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)

GetWithTTL mocks base method.

func (*MockStoreInterface) Invalidate

func (m *MockStoreInterface) Invalidate(ctx context.Context, options ...InvalidateOption) error

Invalidate mocks base method.

func (*MockStoreInterface) Set

func (m *MockStoreInterface) Set(ctx context.Context, key, value any, options ...Option) error

Set mocks base method.

type MockStoreInterfaceMockRecorder

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

MockStoreInterfaceMockRecorder is the mock recorder for MockStoreInterface.

func (*MockStoreInterfaceMockRecorder) Clear

func (mr *MockStoreInterfaceMockRecorder) Clear(ctx interface{}) *gomock.Call

Clear indicates an expected call of Clear.

func (*MockStoreInterfaceMockRecorder) Delete

func (mr *MockStoreInterfaceMockRecorder) Delete(ctx, key interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockStoreInterfaceMockRecorder) Get

func (mr *MockStoreInterfaceMockRecorder) Get(ctx, key interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockStoreInterfaceMockRecorder) GetType

GetType indicates an expected call of GetType.

func (*MockStoreInterfaceMockRecorder) GetWithTTL

func (mr *MockStoreInterfaceMockRecorder) GetWithTTL(ctx, key interface{}) *gomock.Call

GetWithTTL indicates an expected call of GetWithTTL.

func (*MockStoreInterfaceMockRecorder) Invalidate

func (mr *MockStoreInterfaceMockRecorder) Invalidate(ctx interface{}, options ...interface{}) *gomock.Call

Invalidate indicates an expected call of Invalidate.

func (*MockStoreInterfaceMockRecorder) Set

func (mr *MockStoreInterfaceMockRecorder) Set(ctx, key, value interface{}, options ...interface{}) *gomock.Call

Set indicates an expected call of Set.

type NotFound

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

func (NotFound) Cause

func (e NotFound) Cause() error

func (NotFound) Error

func (e NotFound) Error() string

func (NotFound) Is

func (e NotFound) Is(err error) bool

func (NotFound) Unwrap

func (e NotFound) Unwrap() error

type Option

type Option func(o *Options)

Option represents a store option function.

func WithClientSideCaching

func WithClientSideCaching(clientSideCacheExpiration time.Duration) Option

WithClientSideCaching allows setting the client side caching, enabled by default Currently to be used by Rueidis(redis) library only.

func WithCost

func WithCost(cost int64) Option

WithCost allows setting the memory capacity used by the item when setting a value. Actually it seems to be used by Ristretto library only.

func WithExpiration

func WithExpiration(expiration time.Duration) Option

WithExpiration allows to specify an expiration time when setting a value.

func WithSynchronousSet

func WithSynchronousSet() Option

WithSynchronousSet allows setting the behavior when setting a value, whether to wait until all buffered writes have been applied or not. Currently to be used by Ristretto library only.

func WithTags

func WithTags(tags []string) Option

WithTags allows to specify associated tags to the current value.

type Options

type Options struct {
	SynchronousSet            bool
	Cost                      int64
	Expiration                time.Duration
	Tags                      []string
	ClientSideCacheExpiration time.Duration
}

func ApplyOptions

func ApplyOptions(opts ...Option) *Options

func ApplyOptionsWithDefault

func ApplyOptionsWithDefault(defaultOptions *Options, opts ...Option) *Options

func (*Options) IsEmpty

func (o *Options) IsEmpty() bool

type OptionsMatcher

type OptionsMatcher struct {
	Cost       int64
	Expiration time.Duration
	Tags       []string
}

func (OptionsMatcher) Matches

func (m OptionsMatcher) Matches(x interface{}) bool

func (OptionsMatcher) String

func (m OptionsMatcher) String() string

type StoreInterface

type StoreInterface interface {
	Get(ctx context.Context, key any) (any, error)
	GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)
	Set(ctx context.Context, key any, value any, options ...Option) error
	Delete(ctx context.Context, key any) error
	Invalidate(ctx context.Context, options ...InvalidateOption) error
	Clear(ctx context.Context) error
	GetType() string
}

StoreInterface is the interface for all available stores

Jump to

Keyboard shortcuts

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