cache

package
v5.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package cache is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var WireCache = wire.NewSet(NewCacheImpl)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	SetWithTTL(key CacheKey, value []byte, seconds int) error
	Remember(key CacheKey, seconds int, fn func() ([]byte, error), force bool) ([]byte, error)
	Clear(key CacheKey) error
	Store() Store
}

func NewCacheImpl

func NewCacheImpl(cfg *config.Config, data data.Data, logger mlog.Logger, sf *singleflight.Group) (ca Cache)

type CacheKey

type CacheKey interface {
	String() string
	Slug() string
}

type Key

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

func NewKey

func NewKey(slug string, vals ...any) *Key

NewKey impl contracts.CacheKey

func (*Key) Slug

func (c *Key) Slug() string

Slug key slug: key-1 => key, key-2 => key

func (*Key) String

func (c *Key) String() string

String key string: key-1, key-2

type MetricsForCache

type MetricsForCache struct {
	Cache Cache
}

func (*MetricsForCache) Clear

func (m *MetricsForCache) Clear(key CacheKey) error

Clear TODO.

func (*MetricsForCache) Remember

func (m *MetricsForCache) Remember(key CacheKey, seconds int, fn func() ([]byte, error), force bool) ([]byte, error)

Remember TODO.

func (*MetricsForCache) SetWithTTL

func (m *MetricsForCache) SetWithTTL(key CacheKey, value []byte, seconds int) error

SetWithTTL TODO.

func (*MetricsForCache) Store

func (m *MetricsForCache) Store() Store

Store TODO.

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(arg0 CacheKey) error

Clear 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) Remember

func (m *MockCache) Remember(arg0 CacheKey, arg1 int, arg2 func() ([]byte, error), arg3 bool) ([]byte, error)

Remember mocks base method.

func (*MockCache) SetWithTTL

func (m *MockCache) SetWithTTL(arg0 CacheKey, arg1 []byte, arg2 int) error

SetWithTTL mocks base method.

func (*MockCache) Store

func (m *MockCache) Store() Store

Store mocks base method.

type MockCacheMockRecorder

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

MockCacheMockRecorder is the mock recorder for MockCache.

func (*MockCacheMockRecorder) Clear

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

Clear indicates an expected call of Clear.

func (*MockCacheMockRecorder) Remember

func (mr *MockCacheMockRecorder) Remember(arg0, arg1, arg2, arg3 any) *gomock.Call

Remember indicates an expected call of Remember.

func (*MockCacheMockRecorder) SetWithTTL

func (mr *MockCacheMockRecorder) SetWithTTL(arg0, arg1, arg2 any) *gomock.Call

SetWithTTL indicates an expected call of SetWithTTL.

func (*MockCacheMockRecorder) Store

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

Store indicates an expected call of Store.

type NoCache

type NoCache struct{}

func (*NoCache) Clear

func (n *NoCache) Clear(key CacheKey) error

Clear TODO.

func (*NoCache) Remember

func (n *NoCache) Remember(key CacheKey, seconds int, fn func() ([]byte, error), force bool) ([]byte, error)

Remember TODO.

func (*NoCache) SetWithTTL

func (n *NoCache) SetWithTTL(key CacheKey, value []byte, seconds int) error

SetWithTTL TODO.

func (*NoCache) Store

func (n *NoCache) Store() Store

Store TODO.

type Store

type Store interface {
	Get(key string) (value []byte, err error)
	Set(key string, value []byte, expireSeconds int) (err error)
	Delete(key string) error
}

func NewDBStore

func NewDBStore(data data.Data) Store

func NewGoCacheAdapter

func NewGoCacheAdapter(c *cache.Cache) Store

NewGoCacheAdapter return Store instance.

Jump to

Keyboard shortcuts

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