cache

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package cache is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache 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, object any, options ...store.Option) error
	Delete(ctx context.Context, key any) error
	Invalidate(ctx context.Context, options ...store.InvalidateOption) error
	Clear(ctx context.Context) error
	GetType() string
	GetStore() store.Store
	GetStats() *Stats
	// contains filtered or unexported methods
}

Cache is an interface for a cache with methods to get, set, delete, invalidate, and clear cache entries.

var DefaultCache Cache

func New

func New(store store.Store) Cache

New creates a new cache instance with the given store.

type CacheKeyGenerator

type CacheKeyGenerator interface {
	GetCacheKey() string
}

CacheKeyGenerator is an interface for generating cache keys.

type MockCache

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

MockCache is a mock of Cache interface.

func NewMockCache

func NewMockCache(ctrl *gomock.Controller) *MockCache

NewMockCache creates a new mock instance.

func (*MockCache) Clear

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

Clear mocks base method.

func (*MockCache) Delete

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

Delete mocks base method.

func (*MockCache) EXPECT

func (m *MockCache) EXPECT() *MockCacheMockRecorder

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

func (*MockCache) Get

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

Get mocks base method.

func (*MockCache) GetStats

func (m *MockCache) GetStats() *Stats

GetStats mocks base method.

func (*MockCache) GetStore

func (m *MockCache) GetStore() store.Store

GetStore mocks base method.

func (*MockCache) GetType

func (m *MockCache) GetType() string

GetType mocks base method.

func (*MockCache) GetWithTTL

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

GetWithTTL mocks base method.

func (*MockCache) Invalidate

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

Invalidate mocks base method.

func (*MockCache) Set

func (m *MockCache) Set(ctx context.Context, key, object any, options ...store.Option) error

Set mocks base method.

type MockCacheKeyGenerator

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

MockCacheKeyGenerator is a mock of CacheKeyGenerator interface.

func NewMockCacheKeyGenerator

func NewMockCacheKeyGenerator(ctrl *gomock.Controller) *MockCacheKeyGenerator

NewMockCacheKeyGenerator creates a new mock instance.

func (*MockCacheKeyGenerator) EXPECT

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

func (*MockCacheKeyGenerator) GetCacheKey

func (m *MockCacheKeyGenerator) GetCacheKey() string

GetCacheKey mocks base method.

type MockCacheKeyGeneratorMockRecorder

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

MockCacheKeyGeneratorMockRecorder is the mock recorder for MockCacheKeyGenerator.

func (*MockCacheKeyGeneratorMockRecorder) GetCacheKey

func (mr *MockCacheKeyGeneratorMockRecorder) GetCacheKey() *gomock.Call

GetCacheKey indicates an expected call of GetCacheKey.

type MockCacheMockRecorder

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

MockCacheMockRecorder is the mock recorder for MockCache.

func (*MockCacheMockRecorder) Clear

func (mr *MockCacheMockRecorder) Clear(ctx any) *gomock.Call

Clear indicates an expected call of Clear.

func (*MockCacheMockRecorder) Delete

func (mr *MockCacheMockRecorder) Delete(ctx, key any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockCacheMockRecorder) Get

func (mr *MockCacheMockRecorder) Get(ctx, key any) *gomock.Call

Get indicates an expected call of Get.

func (*MockCacheMockRecorder) GetStats

func (mr *MockCacheMockRecorder) GetStats() *gomock.Call

GetStats indicates an expected call of GetStats.

func (*MockCacheMockRecorder) GetStore

func (mr *MockCacheMockRecorder) GetStore() *gomock.Call

GetStore indicates an expected call of GetStore.

func (*MockCacheMockRecorder) GetType

func (mr *MockCacheMockRecorder) GetType() *gomock.Call

GetType indicates an expected call of GetType.

func (*MockCacheMockRecorder) GetWithTTL

func (mr *MockCacheMockRecorder) GetWithTTL(ctx, key any) *gomock.Call

GetWithTTL indicates an expected call of GetWithTTL.

func (*MockCacheMockRecorder) Invalidate

func (mr *MockCacheMockRecorder) Invalidate(ctx any, options ...any) *gomock.Call

Invalidate indicates an expected call of Invalidate.

func (*MockCacheMockRecorder) Set

func (mr *MockCacheMockRecorder) Set(ctx, key, object any, options ...any) *gomock.Call

Set indicates an expected call of Set.

type Stats

type Stats struct {
	Hits              int
	Miss              int
	SetSuccess        int
	SetError          int
	DeleteSuccess     int
	DeleteError       int
	InvalidateSuccess int
	InvalidateError   int
	ClearSuccess      int
	ClearError        int
}

Stats holds statistics about cache operations.

Directories

Path Synopsis
Package store is a generated GoMock package.
Package store is a generated GoMock package.

Jump to

Keyboard shortcuts

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