redis

package
v0.0.0-...-221a75c Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 4 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
}

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 *radix.Pool, 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