redistorage

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

func NewQueue

func NewQueue(s *Storage, qk string, pk string, c QueueConfig) *Queue

NewQueue creates a new redis reliable queue instance

func (*Queue) Done

func (q *Queue) Done(i string) error

Done removes the item from the processing list

func (*Queue) Errors

func (q *Queue) Errors() <-chan error

Errors feeds any errors happening while listening for items through a channel

func (*Queue) Items

func (q *Queue) Items() <-chan string

Items feeds queue items through a channel

func (*Queue) Start

func (q *Queue) Start()

Start the blocking redis queue reader

type QueueConfig

type QueueConfig struct {
	BlockingDuration  time.Duration
	ProcessingTimeout time.Duration
}

QueueConfig configures the queue settings

type Storage

type Storage struct {
	Client   *redis.Client
	Receiver chan redis.Message
}

Storage facilitates streaming to redis

func New

func New(host, password string) *Storage

New create a new redis cache connection

func (*Storage) Count

func (s *Storage) Count(pattern string) (int64, error)

Count counts elements following a pattern

func (*Storage) Duplicate

func (s *Storage) Duplicate(key string, newKey string) error

Duplicate creates a copy of a key

func (*Storage) Exists

func (s *Storage) Exists(keys ...string) (int64, error)

Exists checks if keys exist and returns count of existing

func (*Storage) Expire

func (s *Storage) Expire(key string, after time.Duration) error

Expire expires a key after duration

func (*Storage) Get

func (s *Storage) Get(key string) (string, error)

Get a value at key

func (*Storage) GetField

func (s *Storage) GetField(key string, field string) (string, error)

GetField gets field of a redis hashmap

func (*Storage) GetInt

func (s *Storage) GetInt(key string) (int64, error)

GetInt gets value as int

func (*Storage) GetKeys

func (s *Storage) GetKeys(pattern string) ([]string, error)

GetKeys gets all keys for pattern

func (*Storage) GetMap

func (s *Storage) GetMap(key string) (map[string]string, error)

GetMap gets all fields of a redis hashmap

func (*Storage) GetMapFields

func (s *Storage) GetMapFields(key string, fields ...string) ([]interface{}, error)

GetMapFields gets fields from map

func (*Storage) GetScore

func (s *Storage) GetScore(key string, member string) (float64, error)

GetScore gets core of member from set

func (*Storage) GetSortedSetHTL

func (s *Storage) GetSortedSetHTL(key string, start int64, stop int64) ([]string, error)

GetSortedSetHTL gets sorted set at key high to low

func (*Storage) GetSortedSetLTH

func (s *Storage) GetSortedSetLTH(key string, start int64, stop int64) ([]string, error)

GetSortedSetLTH gets sorted set at key low to high

func (*Storage) GetStruct

func (s *Storage) GetStruct(key string, obj interface{}) error

GetStruct gets a value at key as struct obj needs to follow UnmarshalBinary interface

func (*Storage) IncrementMapField

func (s *Storage) IncrementMapField(key string, field string, inc int) error

IncrementMapField Increments a hash maps field by value

func (*Storage) IncrementSortedSetMemberScore

func (s *Storage) IncrementSortedSetMemberScore(key string, member string, inc float64) error

IncrementSortedSetMemberScore Increments the score of a sorted set member

func (*Storage) KeyExists

func (s *Storage) KeyExists(key string) (bool, error)

KeyExists checks if single key exists

func (*Storage) KeysPrefixCount

func (s *Storage) KeysPrefixCount(prefix string) (int64, error)

KeysPrefixCount returns the number of keys with a given prefix

func (*Storage) ListBlockingPopAndPush

func (s *Storage) ListBlockingPopAndPush(from, to string, wait time.Duration) (string, error)

ListBlockingPopAndPush Blocks until an item is available, pops it from a list and pushes it to another times out after 10 minutes

func (*Storage) ListGet

func (s *Storage) ListGet(key string, index int64) (string, error)

ListGet returns list element at index

func (*Storage) ListLen

func (s *Storage) ListLen(key string) (int64, error)

Lists ListLen returns a list length

func (*Storage) ListPush

func (s *Storage) ListPush(key string, values ...interface{}) error

ListPush appends to list at key

func (*Storage) ListRemove

func (s *Storage) ListRemove(key string, count int64, value string) (int64, error)

ListRemove removes count of item from list

func (*Storage) ListShift

func (s *Storage) ListShift(key string) (string, error)

ListShift removes first list element and returns it

func (*Storage) ListUnshift

func (s *Storage) ListUnshift(key string, values ...interface{}) error

ListUnshift prepends to list

func (*Storage) MoveSortedSetMemberUpdating

func (s *Storage) MoveSortedSetMemberUpdating(fromKey string, toKey string, member string, newScore float64) error

MoveSortedSetMemberUpdating moves a sorted set member between sets and updates score

func (*Storage) Publish

func (s *Storage) Publish(channel string, message string) error

Publish pushes a message to a channel

func (*Storage) Remove

func (s *Storage) Remove(keys ...string) (int64, error)

Remove deletes keys and values

func (*Storage) Rename

func (s *Storage) Rename(key, newKey string) error

Rename renames a key to another

func (*Storage) Set

func (s *Storage) Set(key string, value interface{}, expiration time.Duration) error

Set a value at key

func (*Storage) SetAdd

func (s *Storage) SetAdd(key string, member string) error

SetAdd adds member to a set at key

func (*Storage) SetGet

func (s *Storage) SetGet(key string) ([]string, error)

GetSet gets set at key

func (*Storage) SetHasMember

func (s *Storage) SetHasMember(key string, member string) (bool, error)

func (*Storage) SetIfNotExists

func (s *Storage) SetIfNotExists(key string, value interface{}, expiration time.Duration) (bool, error)

SetIfNotExists only sets if it doesn't exist

func (*Storage) SetMap

func (s *Storage) SetMap(key string, fields map[string]interface{}) error

SetMap sets fields of a redis hashmap

func (*Storage) SetMapField

func (s *Storage) SetMapField(key string, field string, value string) error

SetMapField sets a field of a redis hashmap

func (*Storage) SortedSetAdd

func (s *Storage) SortedSetAdd(key string, member string, score float64) error

SortedSetAdd adds a member with score to sorted set

func (*Storage) SortedSetCount

func (s *Storage) SortedSetCount(key, min, max string) (int64, error)

SortedSetCount adds a member with score to sorted set

func (*Storage) SortedSetGetByScore

func (s *Storage) SortedSetGetByScore(key string, min string, max string, limit int64) ([]string, error)

SortedSetGetByScore

func (*Storage) SortedSetRemove

func (s *Storage) SortedSetRemove(key string, member ...interface{}) (int64, error)

SortedSetRemove adds a member with score to sorted set

func (*Storage) SortedSetRemoveByScore

func (s *Storage) SortedSetRemoveByScore(key string, min string, max string) (int64, error)

SortedSetRemoveByScore

func (*Storage) SortedSetUpdate

func (s *Storage) SortedSetUpdate(key string, member string, score float64) error

SortedSetUpdate only sets score if it exists

func (*Storage) SortedSetsCardSum

func (s *Storage) SortedSetsCardSum(prefix string) (int64, error)

SortedSetsCardSum returns the total number of elements in a list of sets

func (*Storage) Start

func (s *Storage) Start(subs ...string)

Start connects to redis and starts listening for events

Jump to

Keyboard shortcuts

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