redis

package
v0.0.0-...-d9e0b2c Latest Latest
Warning

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

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

Documentation

Overview

Package redis allows reading/writing from/to a Redis DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redis

type Redis struct {

	//Pool   *radix.Pool
	Bus    message.Bus
	Silent bool
	TTL    bool
	// contains filtered or unexported fields
}

Redis holds references to a DB pool and a shared message bus. Silent disables verbose mode. TTL enables TTL sync.

func New

func New(source *redis.Client, bus message.Bus, silent, ttl bool) *Redis

New creates the Redis struct, used to read/write.

func (*Redis) Read

func (r *Redis) Read(ctx context.Context) error

Read gently scans an entire Redis DB for keys, then dumps the key/value pair (Payload) on the message Bus channel. It leverages implicit pipelining to speedup large DB reads. To be used in an ErrGroup.

func (*Redis) Write

func (r *Redis) Write(ctx context.Context) error

Write restores keys on the db as they come on the message bus.

Jump to

Keyboard shortcuts

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