Documentation ¶
Overview ¶
Package freecache is a generated GoMock package.
Index ¶
- Constants
- type FreecacheClientInterface
- type FreecacheStore
- func (f *FreecacheStore) Clear(_ context.Context) error
- func (f *FreecacheStore) Delete(_ context.Context, key any) error
- func (f *FreecacheStore) Get(_ context.Context, key any) (any, error)
- func (f *FreecacheStore) GetType() string
- func (f *FreecacheStore) GetWithTTL(_ context.Context, key any) (any, time.Duration, error)
- func (f *FreecacheStore) Invalidate(ctx context.Context, options ...lib_store.InvalidateOption) error
- func (f *FreecacheStore) Set(ctx context.Context, key any, value any, options ...lib_store.Option) error
- type MockFreecacheClientInterface
- func (m *MockFreecacheClientInterface) Clear()
- func (m *MockFreecacheClientInterface) Del(key []byte) bool
- func (m *MockFreecacheClientInterface) DelInt(key int64) bool
- func (m *MockFreecacheClientInterface) EXPECT() *MockFreecacheClientInterfaceMockRecorder
- func (m *MockFreecacheClientInterface) Get(key []byte) ([]byte, error)
- func (m *MockFreecacheClientInterface) GetInt(key int64) ([]byte, error)
- func (m *MockFreecacheClientInterface) Set(key, value []byte, expireSeconds int) error
- func (m *MockFreecacheClientInterface) SetInt(key int64, value []byte, expireSeconds int) error
- func (m *MockFreecacheClientInterface) TTL(key []byte) (uint32, error)
- type MockFreecacheClientInterfaceMockRecorder
- func (mr *MockFreecacheClientInterfaceMockRecorder) Clear() *gomock.Call
- func (mr *MockFreecacheClientInterfaceMockRecorder) Del(key interface{}) *gomock.Call
- func (mr *MockFreecacheClientInterfaceMockRecorder) DelInt(key interface{}) *gomock.Call
- func (mr *MockFreecacheClientInterfaceMockRecorder) Get(key interface{}) *gomock.Call
- func (mr *MockFreecacheClientInterfaceMockRecorder) GetInt(key interface{}) *gomock.Call
- func (mr *MockFreecacheClientInterfaceMockRecorder) Set(key, value, expireSeconds interface{}) *gomock.Call
- func (mr *MockFreecacheClientInterfaceMockRecorder) SetInt(key, value, expireSeconds interface{}) *gomock.Call
- func (mr *MockFreecacheClientInterfaceMockRecorder) TTL(key interface{}) *gomock.Call
Constants ¶
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 ¶
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 ¶
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 ¶
func (m *MockFreecacheClientInterface) EXPECT() *MockFreecacheClientInterfaceMockRecorder
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.
type MockFreecacheClientInterfaceMockRecorder ¶
type MockFreecacheClientInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockFreecacheClientInterfaceMockRecorder is the mock recorder for MockFreecacheClientInterface.
func (*MockFreecacheClientInterfaceMockRecorder) Clear ¶
func (mr *MockFreecacheClientInterfaceMockRecorder) Clear() *gomock.Call
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.