memory

package
v0.0.0-...-a98e843 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package memory implements a service to store data in memory. This can be used for development and testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsInvalidExecution

func IsInvalidExecution(err error) bool

IsInvalidExecution asserts invalidExecutionError.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound asserts notFoundError.

Types

type Backoff

type Backoff interface {
	// NextBackOff provides the duration expected to wait before retrying an
	// action. time.Duration = -1 indicates that no more retry should be
	// attempted.
	NextBackOff() time.Duration
	// Reset sets the backoff back to its initial state.
	Reset()
}

Backoff represents the object managing backoff algorithms to retry actions.

type Config

type Config struct {
}

Config represents the configuration used to create a new storage service.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig provides a default configuration to create a new storage service by best effort.

type Service

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

func New

func New(config Config) (*Service, error)

New creates a new storage service. Therefore it manages an in-memory redis instance which can be shut down using the configured closer. This is used for local development.

func (*Service) Boot

func (s *Service) Boot()

func (*Service) Exists

func (s *Service) Exists(key string) (bool, error)

func (*Service) ExistsInScoredSet

func (s *Service) ExistsInScoredSet(key, element string) (bool, error)

func (*Service) Get

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

func (*Service) GetAllFromList

func (s *Service) GetAllFromList(key string) ([]string, error)

func (*Service) GetAllFromSet

func (s *Service) GetAllFromSet(key string) ([]string, error)

func (*Service) GetElementsByScore

func (s *Service) GetElementsByScore(key string, score float64, maxElements int) ([]string, error)

func (*Service) GetHighestScoredElements

func (s *Service) GetHighestScoredElements(key string, maxElements int) ([]string, error)

func (*Service) GetRandom

func (s *Service) GetRandom() (string, error)

func (*Service) GetRandomFromScoredSet

func (s *Service) GetRandomFromScoredSet(key string) (string, error)

func (*Service) GetRandomFromSet

func (s *Service) GetRandomFromSet(key string) (string, error)

func (*Service) GetScoreOfElement

func (s *Service) GetScoreOfElement(key, element string) (float64, error)

func (*Service) GetStringMap

func (s *Service) GetStringMap(key string) (map[string]string, error)

func (*Service) Increment

func (s *Service) Increment(key string, n float64) (float64, error)

func (*Service) IncrementScoredElement

func (s *Service) IncrementScoredElement(key, element string, n float64) (float64, error)

func (*Service) LengthOfList

func (s *Service) LengthOfList(key string) (int, error)

func (*Service) LengthOfScoredSet

func (s *Service) LengthOfScoredSet(key string) (int, error)

func (*Service) PopFromList

func (s *Service) PopFromList(key string) (string, error)

func (*Service) PushToList

func (s *Service) PushToList(key string, element string) error

func (*Service) PushToSet

func (s *Service) PushToSet(key string, element string) error

func (*Service) Remove

func (s *Service) Remove(key string) error

func (*Service) RemoveFromList

func (s *Service) RemoveFromList(key string, element string) error

func (*Service) RemoveFromSet

func (s *Service) RemoveFromSet(key string, element string) error

func (*Service) RemoveScoredElement

func (s *Service) RemoveScoredElement(key string, element string) error

func (*Service) Set

func (s *Service) Set(key, value string) error

func (*Service) SetElementByScore

func (s *Service) SetElementByScore(key, element string, score float64) error

func (*Service) SetStringMap

func (s *Service) SetStringMap(key string, stringMap map[string]string) error

func (*Service) Shutdown

func (s *Service) Shutdown()

func (*Service) TrimEndOfList

func (s *Service) TrimEndOfList(key string, maxElements int) error

func (*Service) WalkKeys

func (s *Service) WalkKeys(glob string, closer <-chan struct{}, cb func(key string) error) error

func (*Service) WalkScoredSet

func (s *Service) WalkScoredSet(key string, closer <-chan struct{}, cb func(element string, score float64) error) error

func (*Service) WalkSet

func (s *Service) WalkSet(key string, closer <-chan struct{}, cb func(element string) error) error

Jump to

Keyboard shortcuts

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