Documentation ¶
Index ¶
- Variables
- type Config
- type ConfigOption
- type Interceptor
- type Manager
- type MockManager
- func (_m *MockManager) Del(ctx context.Context, key string) error
- func (_m *MockManager) Eval(ctx context.Context, script string, keys []string, args ...interface{}) (interface{}, error)
- func (_m *MockManager) Expire(ctx context.Context, key string, expire time.Duration) error
- func (_m *MockManager) Get(ctx context.Context, key string) (string, error)
- func (_m *MockManager) GetBlob(ctx context.Context, key string, output interface{}) error
- func (_m *MockManager) Set(ctx context.Context, key string, raw string, expire time.Duration) error
- func (_m *MockManager) SetBlob(ctx context.Context, key string, val interface{}, expire time.Duration) error
- func (_m *MockManager) SetNx(ctx context.Context, key string, raw string, expire time.Duration) (bool, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ConfigOption ¶
type ConfigOption func(*Config)
func WithEnableMetrics ¶
func WithEnableMetrics(enable bool) ConfigOption
func WithEnableTraffic ¶
func WithEnableTraffic(enable bool) ConfigOption
type Interceptor ¶
type Interceptor interface {
Apply(client *redis.Client)
}
func NewInterceptor ¶
func NewInterceptor(config Config) Interceptor
func NewInterceptorWithOpts ¶
func NewInterceptorWithOpts(opts ...ConfigOption) Interceptor
type Manager ¶
type Manager interface { // Get returns the value associated with the given key. Get(ctx context.Context, key string) (raw string, err error) // Set stores the given value with the given key. // if expire is 0, then the key will not expire. Set(ctx context.Context, key string, raw string, expire time.Duration) (err error) // SetNx stores the given value with the given key if the key does not exist. // if expire is 0, then the key will not expire. SetNx(ctx context.Context, key string, raw string, expire time.Duration) (existing bool, err error) // GetBlob returns the value associated with the given key. GetBlob(ctx context.Context, key string, output any) (err error) // SetBlob stores the given value with the given key. // if expire is 0, then the key will not expire. SetBlob(ctx context.Context, key string, val any, expire time.Duration) (err error) // Del deletes the given key. Del(ctx context.Context, key string) (err error) // Expire sets the expiration for the given key. // if expire is 0, then the key will not expire. Expire(ctx context.Context, key string, expire time.Duration) (err error) // Eval evaluates the given script with the given keys and arguments. Eval(ctx context.Context, script string, keys []string, args ...any) (val any, err error) }
type MockManager ¶
MockManager is an autogenerated mock type for the Manager type
func NewMockManager ¶
func NewMockManager(t interface { mock.TestingT Cleanup(func()) }) *MockManager
NewMockManager creates a new instance of MockManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockManager) Del ¶
func (_m *MockManager) Del(ctx context.Context, key string) error
Del provides a mock function with given fields: ctx, key
func (*MockManager) Eval ¶
func (_m *MockManager) Eval(ctx context.Context, script string, keys []string, args ...interface{}) (interface{}, error)
Eval provides a mock function with given fields: ctx, script, keys, args
func (*MockManager) GetBlob ¶
func (_m *MockManager) GetBlob(ctx context.Context, key string, output interface{}) error
GetBlob provides a mock function with given fields: ctx, key, output
Source Files ¶
Click to show internal directories.
Click to hide internal directories.