cache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Write(key, value string) error
	Read(key string, value interface{}) error
	ReadOwners() ([]string, error)
	ReadCandidates(owner string) []string
	CandidateExists(owner, candidate string) bool
	WriteTimer(key, value string, ttl time.Time) error
	TimerExists(key string) bool
	Delete(key, value string) error
}

type MockCache

type MockCache struct{}

func NewMockCache

func NewMockCache() *MockCache

func (*MockCache) CandidateExists

func (mc *MockCache) CandidateExists(owner, candidate string) bool

func (*MockCache) Delete

func (mc *MockCache) Delete(key, value string) error

func (*MockCache) Read

func (mc *MockCache) Read(key string, value interface{}) error

func (*MockCache) ReadCandidates

func (mc *MockCache) ReadCandidates(owner string) []string

func (*MockCache) ReadOwners

func (mc *MockCache) ReadOwners() ([]string, error)

func (*MockCache) TimerExists

func (mc *MockCache) TimerExists(key string) bool

func (*MockCache) Write

func (mc *MockCache) Write(key, value string) error

func (*MockCache) WriteTimer

func (mc *MockCache) WriteTimer(key, value string, ttl time.Time) error

type RedisCache

type RedisCache struct {
	Config *config.Config
	Logger *logrus.Logger
	Client *redis.Client
}

func NewRedisCache

func NewRedisCache(cfg *config.Config, logger *logrus.Logger) (*RedisCache, error)

func (*RedisCache) CandidateExists

func (rc *RedisCache) CandidateExists(owner, candidate string) bool

func (*RedisCache) Delete

func (rc *RedisCache) Delete(key, value string) error

func (*RedisCache) Read

func (rc *RedisCache) Read(key string, value interface{}) error

func (*RedisCache) ReadCandidates

func (rc *RedisCache) ReadCandidates(owner string) []string

func (*RedisCache) ReadOwners

func (rc *RedisCache) ReadOwners() ([]string, error)

func (*RedisCache) TimerExists

func (rc *RedisCache) TimerExists(key string) bool

func (*RedisCache) Write

func (rc *RedisCache) Write(key, value string) error

func (*RedisCache) WriteTimer

func (rc *RedisCache) WriteTimer(key, value string, ttl time.Time) error

Jump to

Keyboard shortcuts

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