redis

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT, MIT Imports: 8 Imported by: 1

Documentation

Overview

Package redis is a generated GoMock package.

Index

Constants

View Source
const (
	// RedisType represents the storage type as a string value
	RedisType = "redis"
	// RedisTagPattern represents the tag pattern to be used as a key in specified storage
	RedisTagPattern = "gocache_tag_%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MockRedisClientInterface

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

MockRedisClientInterface is a mock of RedisClientInterface interface.

func NewMockRedisClientInterface

func NewMockRedisClientInterface(ctrl *gomock.Controller) *MockRedisClientInterface

NewMockRedisClientInterface creates a new mock instance.

func (*MockRedisClientInterface) Del

func (m *MockRedisClientInterface) Del(ctx context.Context, keys ...string) *v9.IntCmd

Del mocks base method.

func (*MockRedisClientInterface) EXPECT

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

func (*MockRedisClientInterface) Expire

func (m *MockRedisClientInterface) Expire(ctx context.Context, key string, expiration time.Duration) *v9.BoolCmd

Expire mocks base method.

func (*MockRedisClientInterface) FlushAll

FlushAll mocks base method.

func (*MockRedisClientInterface) Get

Get mocks base method.

func (*MockRedisClientInterface) SAdd

func (m *MockRedisClientInterface) SAdd(ctx context.Context, key string, members ...any) *v9.IntCmd

SAdd mocks base method.

func (*MockRedisClientInterface) SMembers

SMembers mocks base method.

func (*MockRedisClientInterface) Set

func (m *MockRedisClientInterface) Set(ctx context.Context, key string, values any, expiration time.Duration) *v9.StatusCmd

Set mocks base method.

func (*MockRedisClientInterface) TTL

TTL mocks base method.

type MockRedisClientInterfaceMockRecorder

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

MockRedisClientInterfaceMockRecorder is the mock recorder for MockRedisClientInterface.

func (*MockRedisClientInterfaceMockRecorder) Del

func (mr *MockRedisClientInterfaceMockRecorder) Del(ctx interface{}, keys ...interface{}) *gomock.Call

Del indicates an expected call of Del.

func (*MockRedisClientInterfaceMockRecorder) Expire

func (mr *MockRedisClientInterfaceMockRecorder) Expire(ctx, key, expiration interface{}) *gomock.Call

Expire indicates an expected call of Expire.

func (*MockRedisClientInterfaceMockRecorder) FlushAll

func (mr *MockRedisClientInterfaceMockRecorder) FlushAll(ctx interface{}) *gomock.Call

FlushAll indicates an expected call of FlushAll.

func (*MockRedisClientInterfaceMockRecorder) Get

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

Get indicates an expected call of Get.

func (*MockRedisClientInterfaceMockRecorder) SAdd

func (mr *MockRedisClientInterfaceMockRecorder) SAdd(ctx, key interface{}, members ...interface{}) *gomock.Call

SAdd indicates an expected call of SAdd.

func (*MockRedisClientInterfaceMockRecorder) SMembers

func (mr *MockRedisClientInterfaceMockRecorder) SMembers(ctx, key interface{}) *gomock.Call

SMembers indicates an expected call of SMembers.

func (*MockRedisClientInterfaceMockRecorder) Set

func (mr *MockRedisClientInterfaceMockRecorder) Set(ctx, key, values, expiration interface{}) *gomock.Call

Set indicates an expected call of Set.

func (*MockRedisClientInterfaceMockRecorder) TTL

func (mr *MockRedisClientInterfaceMockRecorder) TTL(ctx, key interface{}) *gomock.Call

TTL indicates an expected call of TTL.

type RedisClientInterface

type RedisClientInterface interface {
	Get(ctx context.Context, key string) *redis.StringCmd
	TTL(ctx context.Context, key string) *redis.DurationCmd
	Expire(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
	Set(ctx context.Context, key string, values any, expiration time.Duration) *redis.StatusCmd
	Del(ctx context.Context, keys ...string) *redis.IntCmd
	FlushAll(ctx context.Context) *redis.StatusCmd
	SAdd(ctx context.Context, key string, members ...any) *redis.IntCmd
	SMembers(ctx context.Context, key string) *redis.StringSliceCmd
}

RedisClientInterface represents a go-redis/redis client

type RedisStore

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

RedisStore is a store for Redis

func NewRedis

func NewRedis(client RedisClientInterface, options ...lib_store.Option) *RedisStore

NewRedis creates a new store to Redis instance(s)

func (*RedisStore) Clear

func (s *RedisStore) Clear(ctx context.Context) error

Clear resets all data in the store

func (*RedisStore) Delete

func (s *RedisStore) Delete(ctx context.Context, key any) error

Delete removes data from Redis for given key identifier

func (*RedisStore) Get

func (s *RedisStore) Get(ctx context.Context, key any) (any, error)

Get returns data stored from a given key

func (*RedisStore) GetType

func (s *RedisStore) GetType() string

GetType returns the store type

func (*RedisStore) GetWithTTL

func (s *RedisStore) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)

GetWithTTL returns data stored from a given key and its corresponding TTL

func (*RedisStore) Invalidate

func (s *RedisStore) Invalidate(ctx context.Context, options ...lib_store.InvalidateOption) error

Invalidate invalidates some cache data in Redis for given options

func (*RedisStore) Set

func (s *RedisStore) Set(ctx context.Context, key any, value any, options ...lib_store.Option) error

Set defines data in Redis for given key identifier

Jump to

Keyboard shortcuts

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