cache

package
v0.9.1-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: AGPL-3.0, AGPL-3.0-only Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generic

type Generic interface {
	Get(ctx context.Context, key string, value interface{}) (bool, error)
	Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error
}

func NewMemoryCache

func NewMemoryCache() Generic

NewMemoryCache return an in-memory cache. This cache backend should be used to cache limited-sized entries like user group permission rule.

func NewRedisCache

func NewRedisCache(cli *redis.Client) Generic

NewRedisCache create a redis backed cache.

type MockGeneric

type MockGeneric struct {
	mock.Mock
}

MockGeneric is an autogenerated mock type for the Generic type

func (*MockGeneric) EXPECT

func (_m *MockGeneric) EXPECT() *MockGeneric_Expecter

func (*MockGeneric) Get

func (_m *MockGeneric) Get(ctx context.Context, key string, value interface{}) (bool, error)

Get provides a mock function with given fields: ctx, key, value

func (*MockGeneric) Set

func (_m *MockGeneric) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error

Set provides a mock function with given fields: ctx, key, value, ttl

type MockGeneric_Expecter

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

func (*MockGeneric_Expecter) Get

func (_e *MockGeneric_Expecter) Get(ctx interface{}, key interface{}, value interface{}) *MockGeneric_Get_Call

Get is a helper method to define mock.On call

  • ctx context.Context
  • key string
  • value interface{}

func (*MockGeneric_Expecter) Set

func (_e *MockGeneric_Expecter) Set(ctx interface{}, key interface{}, value interface{}, ttl interface{}) *MockGeneric_Set_Call

Set is a helper method to define mock.On call

  • ctx context.Context
  • key string
  • value interface{}
  • ttl time.Duration

type MockGeneric_Get_Call

type MockGeneric_Get_Call struct {
	*mock.Call
}

MockGeneric_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockGeneric_Get_Call) Return

func (_c *MockGeneric_Get_Call) Return(_a0 bool, _a1 error) *MockGeneric_Get_Call

func (*MockGeneric_Get_Call) Run

func (_c *MockGeneric_Get_Call) Run(run func(ctx context.Context, key string, value interface{})) *MockGeneric_Get_Call

type MockGeneric_Set_Call

type MockGeneric_Set_Call struct {
	*mock.Call
}

MockGeneric_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'

func (*MockGeneric_Set_Call) Return

func (*MockGeneric_Set_Call) Run

func (_c *MockGeneric_Set_Call) Run(run func(ctx context.Context, key string, value interface{}, ttl time.Duration)) *MockGeneric_Set_Call

Jump to

Keyboard shortcuts

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