storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValue

type KeyValue interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte, expiration time.Duration) error
	Delete(key string) error
	Ready() error
}

KeyValue is the interface for a storage holding key-value pairs.

type KeyValueMock

type KeyValueMock struct {
	mock.Mock
	// contains filtered or unexported fields
}

KeyValueMock is a mock for the KeyValue interface.

func NewKeyValueMock

func NewKeyValueMock() *KeyValueMock

NewKeyValueMock creates a KeyValueMock instance.

func (*KeyValueMock) Delete

func (k *KeyValueMock) Delete(key string) error

Delete implements the method with the same name from KeyValue.

func (*KeyValueMock) Get

func (k *KeyValueMock) Get(key string) ([]byte, error)

Get implements the method with the same name from KeyValue.

func (*KeyValueMock) Ready

func (k *KeyValueMock) Ready() error

Ready implements the method with the same name from KeyValue.

func (*KeyValueMock) Set

func (k *KeyValueMock) Set(key string, value []byte, expiration time.Duration) error

Set implements the method with the same name from KeyValue.

type Redis

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

Redis is a wrapper over the redis client.

func NewRedis

func NewRedis(options *redis.Options) *Redis

NewRedis creates a new instance of Redis storage.

func (*Redis) Delete

func (r *Redis) Delete(key string) error

Delete removes the entry for the specified key.

func (*Redis) Get

func (r *Redis) Get(key string) ([]byte, error)

Get returns the pre-cached value for the given key.

func (*Redis) Ready

func (r *Redis) Ready() error

Ready tells if the redis connection is ready.

func (*Redis) Set

func (r *Redis) Set(key string, value []byte, expiration time.Duration) error

Set sets the value for the specified key in the cache.

Jump to

Keyboard shortcuts

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