redis

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2021 License: MIT Imports: 14 Imported by: 0

README

Overview

This package wraps Redis db access and local concurrent map as a cache.

Dependencies:

Documentation

Index

Constants

View Source
const (
	EventExpire = iota
	EventExpired
	EventDel
)

event types

Variables

View Source
var (
	ErrNotFound = errors.New("Key not found")
)

Functions

func IPKaxap added in v1.0.2

func IPKaxap(k net.IP) string

func KaxapMSISDN added in v1.0.2

func KaxapMSISDN(v string) string

func Msisdn added in v1.0.2

func Msisdn(m *Mirror, input interface{}) (string, error)

func Uint32Kaxap added in v1.0.2

func Uint32Kaxap(k uint32) string

Types

type ChanScanner added in v1.0.2

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

func NewChanScanner added in v1.0.2

func NewChanScanner() *ChanScanner

func (*ChanScanner) Close added in v1.0.2

func (cs *ChanScanner) Close()

func (*ChanScanner) Err added in v1.0.2

func (cs *ChanScanner) Err() error

func (*ChanScanner) HasNext added in v1.0.2

func (cs *ChanScanner) HasNext() bool

func (*ChanScanner) Next added in v1.0.2

func (cs *ChanScanner) Next() string

func (*ChanScanner) Put added in v1.0.2

func (cs *ChanScanner) Put(k string)

type Mirror

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

func NewMirror

func NewMirror(c MirrorConfig) (*Mirror, error)

func (*Mirror) Get

func (m *Mirror) Get(key interface{}) (interface{}, error)

func (*Mirror) Mirror

func (m *Mirror) Mirror(ctx context.Context) error

func (*Mirror) Scan

func (m *Mirror) Scan() error

func (*Mirror) SyncMap

func (m *Mirror) SyncMap() *sync.Map

type MirrorConfig

type MirrorConfig struct {
	Network, Addr string
	DbIndex       int
}

type Redis added in v1.0.2

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

func NewRedis added in v1.0.2

func NewRedis(c RedisConfig) (*Redis, error)

func (*Redis) ConsumeKeyChan added in v1.1.0

func (r *Redis) ConsumeKeyChan(ctx context.Context, ch <-chan interface{}, fn TupleOp) error

func (*Redis) ConsumeScanner added in v1.1.0

func (r *Redis) ConsumeScanner(ctx context.Context, s common.Scanner, fn TupleOp) error

get keys from Scanner, GET them from redis, then process them via TupleOp if TupleOp returns false: stop and return latest error value if error is encountered, finish and return it.

func (*Redis) Get added in v1.0.2

func (r *Redis) Get(key string) (string, error)

func (*Redis) NewKeyEventSource added in v1.0.2

func (r *Redis) NewKeyEventSource() common.ScanCloser

func (*Redis) NewScanner added in v1.1.0

func (r *Redis) NewScanner(window int) common.Scanner

type RedisConfig added in v1.0.2

type RedisConfig struct {
	Network, Addr string
	DbIndex       int
}

type TupleOp added in v1.0.2

type TupleOp func(k, v interface{}) bool

k/v pair handler if v argument in TupleOp is nil then k is absent from db may also be used for iteration, then the bool return value may be used to exit iteration

Jump to

Keyboard shortcuts

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