redis

package
v0.0.0-...-bcfd2cf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL string
}

Config strcut containing initialization fields

func Conf

func Conf(URL string) *Config

Conf returns default config struct

type KV

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

KV instance of key value store designed to treat block structs

func NewKV

func NewKV(r *Redis, c *cache.Cache) (*KV, error)

NewKV creates a new instance of KV

type Redis

type Redis struct {
	*redis.Client
}

Redis client wrapper

func NewRedis

func NewRedis(conf *Config) (*Redis, error)

NewRedis creates a new instance of the db

func (*Redis) Delete

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

Delete inserts in the db the block as []byte passed

func (*Redis) Empty

func (r *Redis) Empty() (err error)

Empty empties the redis store

func (*Redis) IsStored

func (r *Redis) IsStored(key string) bool

IsStored returns true if the block corresponding to passed hash is stored in db

func (*Redis) Read

func (r *Redis) Read(key string) (value []byte, err error)

func (*Redis) ReadFirstValueByPrefix

func (r *Redis) ReadFirstValueByPrefix(prefix string) (value []byte, err error)

ReadFirstValueByPrefix returns the first value matched by prefix

func (*Redis) ReadKeyValues

func (r *Redis) ReadKeyValues() (value map[string][]byte, err error)

ReadKeyValues concurrent read values based on a prefix

func (*Redis) ReadKeys

func (r *Redis) ReadKeys() (value []string, err error)

ReadKeys concurrent read values based on a prefix

func (*Redis) ReadKeysWithPrefix

func (r *Redis) ReadKeysWithPrefix(prefix string) (keys []string, err error)

ReadKeysWithPrefix concurrent read values based on a prefix

func (*Redis) ReadPrefix

func (r *Redis) ReadPrefix(prefix string) (value [][]byte, err error)

ReadPrefix concurrent read values based on a prefix

func (*Redis) ReadPrefixWithKey

func (r *Redis) ReadPrefixWithKey(prefix string) (value map[string][]byte, err error)

ReadPrefixWithKey concurrent read values based on a prefix

func (*Redis) Store

func (r *Redis) Store(key string, value []byte) (err error)

Store insert new key-value in redis

func (*Redis) StoreBatch

func (r *Redis) StoreBatch(batch interface{}) (err error)

StoreBatch insert new key-value in redis

func (*Redis) StoreQueueBatch

func (r *Redis) StoreQueueBatch(v interface{}) (err error)

StoreQueueBatch loads a queue until a threshold to perform a bulk insertion

Jump to

Keyboard shortcuts

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