cache

package
v0.0.0-...-d989180 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cache is a generated GoMock package.

Index

Constants

View Source
const (
	ProviderRedis = "redis"
)

Variables

View Source
var (
	ErrPing = func(err error) error {
		return fmt.Errorf("fail to ping cache provider, details: %v", err)
	}
	ErrInvlaidProvider = func(providerType string) error {
		return fmt.Errorf("invalid cache provider: '%s'", providerType)
	}
	ErrValueIsNotPointer = func() error {
		return fmt.Errorf("value is not pointer")
	}
)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Ping(ctx context.Context) error
	Get(ctx context.Context, key string, v interface{}) error
	Set(ctx context.Context, key string, v interface{}, expire time.Duration) error
	Del(ctx context.Context, key string) error
}

func New

func New(opts Options) (Cache, error)

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) Del

func (m *MockCache) Del(ctx context.Context, key string) error

Del 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 string, v interface{}) error

Get mocks base method.

func (*MockCache) Ping

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

Ping mocks base method.

func (*MockCache) Set

func (m *MockCache) Set(ctx context.Context, key string, v interface{}, expire time.Duration) error

Set mocks base method.

type MockCacheMockRecorder

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

MockCacheMockRecorder is the mock recorder for MockCache.

func (*MockCacheMockRecorder) Del

func (mr *MockCacheMockRecorder) Del(ctx, key interface{}) *gomock.Call

Del indicates an expected call of Del.

func (*MockCacheMockRecorder) Get

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

Get indicates an expected call of Get.

func (*MockCacheMockRecorder) Ping

func (mr *MockCacheMockRecorder) Ping(ctx interface{}) *gomock.Call

Ping indicates an expected call of Ping.

func (*MockCacheMockRecorder) Set

func (mr *MockCacheMockRecorder) Set(ctx, key, v, expire interface{}) *gomock.Call

Set indicates an expected call of Set.

type Options

type Options struct {
	ProviderType string
	Addr         string
	Password     string
	DB           int
	Timeout      time.Duration
	Expiration   time.Duration
}

Jump to

Keyboard shortcuts

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