freecache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Overview

Package freecache is a generated GoMock package.

Index

Constants

View Source
const (
	// FreecacheType represents the storage type as a string value
	FreecacheType = "freecache"
	// FreecacheTagPattern represents the tag pattern to be used as a key in specified storage
	FreecacheTagPattern = "freecache_tag_%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FreecacheClientInterface

type FreecacheClientInterface interface {
	Get(key []byte) (value []byte, err error)
	GetInt(key int64) (value []byte, err error)
	TTL(key []byte) (timeLeft uint32, err error)
	Set(key, value []byte, expireSeconds int) (err error)
	SetInt(key int64, value []byte, expireSeconds int) (err error)
	Del(key []byte) (affected bool)
	DelInt(key int64) (affected bool)
	Clear()
}

FreecacheClientInterface represents a coocood/freecache client

type FreecacheStore

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

FreecacheStore is a store for freecache

func NewFreecache

func NewFreecache(client FreecacheClientInterface, options ...lib_store.Option) *FreecacheStore

NewFreecache creates a new store to freecache instance(s)

func (*FreecacheStore) Clear

func (f *FreecacheStore) Clear(_ context.Context) error

Clear resets all data in the store

func (*FreecacheStore) Delete

func (f *FreecacheStore) Delete(_ context.Context, key any) error

Delete deletes an item in the cache by key and returns err or nil if a delete occurred

func (*FreecacheStore) Get

func (f *FreecacheStore) Get(_ context.Context, key any) (any, error)

Get returns data stored from a given key. It returns the value or not found error

func (*FreecacheStore) GetType

func (f *FreecacheStore) GetType() string

GetType returns the store type

func (*FreecacheStore) GetWithTTL

func (f *FreecacheStore) GetWithTTL(_ context.Context, key any) (any, time.Duration, error)

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

func (*FreecacheStore) Invalidate

func (f *FreecacheStore) Invalidate(ctx context.Context, options ...lib_store.InvalidateOption) error

Invalidate invalidates some cache data in freecache for given options

func (*FreecacheStore) Set

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

Set sets a key, value and expiration for a cache entry and stores it in the cache. If the key is larger than 65535 or value is larger than 1/1024 of the cache size, the entry will not be written to the cache. expireSeconds <= 0 means no expire, but it can be evicted when cache is full.

type MockFreecacheClientInterface

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

MockFreecacheClientInterface is a mock of FreecacheClientInterface interface.

func NewMockFreecacheClientInterface

func NewMockFreecacheClientInterface(ctrl *gomock.Controller) *MockFreecacheClientInterface

NewMockFreecacheClientInterface creates a new mock instance.

func (*MockFreecacheClientInterface) Clear

func (m *MockFreecacheClientInterface) Clear()

Clear mocks base method.

func (*MockFreecacheClientInterface) Del

func (m *MockFreecacheClientInterface) Del(key []byte) bool

Del mocks base method.

func (*MockFreecacheClientInterface) DelInt

func (m *MockFreecacheClientInterface) DelInt(key int64) bool

DelInt mocks base method.

func (*MockFreecacheClientInterface) EXPECT

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

func (*MockFreecacheClientInterface) Get

func (m *MockFreecacheClientInterface) Get(key []byte) ([]byte, error)

Get mocks base method.

func (*MockFreecacheClientInterface) GetInt

func (m *MockFreecacheClientInterface) GetInt(key int64) ([]byte, error)

GetInt mocks base method.

func (*MockFreecacheClientInterface) Set

func (m *MockFreecacheClientInterface) Set(key, value []byte, expireSeconds int) error

Set mocks base method.

func (*MockFreecacheClientInterface) SetInt

func (m *MockFreecacheClientInterface) SetInt(key int64, value []byte, expireSeconds int) error

SetInt mocks base method.

func (*MockFreecacheClientInterface) TTL

func (m *MockFreecacheClientInterface) TTL(key []byte) (uint32, error)

TTL mocks base method.

type MockFreecacheClientInterfaceMockRecorder

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

MockFreecacheClientInterfaceMockRecorder is the mock recorder for MockFreecacheClientInterface.

func (*MockFreecacheClientInterfaceMockRecorder) Clear

Clear indicates an expected call of Clear.

func (*MockFreecacheClientInterfaceMockRecorder) Del

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

Del indicates an expected call of Del.

func (*MockFreecacheClientInterfaceMockRecorder) DelInt

func (mr *MockFreecacheClientInterfaceMockRecorder) DelInt(key interface{}) *gomock.Call

DelInt indicates an expected call of DelInt.

func (*MockFreecacheClientInterfaceMockRecorder) Get

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

Get indicates an expected call of Get.

func (*MockFreecacheClientInterfaceMockRecorder) GetInt

func (mr *MockFreecacheClientInterfaceMockRecorder) GetInt(key interface{}) *gomock.Call

GetInt indicates an expected call of GetInt.

func (*MockFreecacheClientInterfaceMockRecorder) Set

func (mr *MockFreecacheClientInterfaceMockRecorder) Set(key, value, expireSeconds interface{}) *gomock.Call

Set indicates an expected call of Set.

func (*MockFreecacheClientInterfaceMockRecorder) SetInt

func (mr *MockFreecacheClientInterfaceMockRecorder) SetInt(key, value, expireSeconds interface{}) *gomock.Call

SetInt indicates an expected call of SetInt.

func (*MockFreecacheClientInterfaceMockRecorder) TTL

func (mr *MockFreecacheClientInterfaceMockRecorder) TTL(key interface{}) *gomock.Call

TTL indicates an expected call of TTL.

Jump to

Keyboard shortcuts

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