Documentation ¶
Overview ¶
Package memory implements a service to store data in memory. This can be used for development and testing.
Index ¶
- func IsInvalidConfig(err error) bool
- func IsInvalidExecution(err error) bool
- func IsNotFound(err error) bool
- type Backoff
- type Config
- type Service
- func (s *Service) Boot()
- func (s *Service) Exists(key string) (bool, error)
- func (s *Service) ExistsInScoredSet(key, element string) (bool, error)
- func (s *Service) Get(key string) (string, error)
- func (s *Service) GetAllFromList(key string) ([]string, error)
- func (s *Service) GetAllFromSet(key string) ([]string, error)
- func (s *Service) GetElementsByScore(key string, score float64, maxElements int) ([]string, error)
- func (s *Service) GetHighestScoredElements(key string, maxElements int) ([]string, error)
- func (s *Service) GetRandom() (string, error)
- func (s *Service) GetRandomFromScoredSet(key string) (string, error)
- func (s *Service) GetRandomFromSet(key string) (string, error)
- func (s *Service) GetScoreOfElement(key, element string) (float64, error)
- func (s *Service) GetStringMap(key string) (map[string]string, error)
- func (s *Service) Increment(key string, n float64) (float64, error)
- func (s *Service) IncrementScoredElement(key, element string, n float64) (float64, error)
- func (s *Service) LengthOfList(key string) (int, error)
- func (s *Service) LengthOfScoredSet(key string) (int, error)
- func (s *Service) PopFromList(key string) (string, error)
- func (s *Service) PushToList(key string, element string) error
- func (s *Service) PushToSet(key string, element string) error
- func (s *Service) Remove(key string) error
- func (s *Service) RemoveFromList(key string, element string) error
- func (s *Service) RemoveFromSet(key string, element string) error
- func (s *Service) RemoveScoredElement(key string, element string) error
- func (s *Service) Set(key, value string) error
- func (s *Service) SetElementByScore(key, element string, score float64) error
- func (s *Service) SetStringMap(key string, stringMap map[string]string) error
- func (s *Service) Shutdown()
- func (s *Service) TrimEndOfList(key string, maxElements int) error
- func (s *Service) WalkKeys(glob string, closer <-chan struct{}, cb func(key string) error) error
- func (s *Service) WalkScoredSet(key string, closer <-chan struct{}, ...) error
- func (s *Service) WalkSet(key string, closer <-chan struct{}, cb func(element string) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func IsInvalidExecution ¶
IsInvalidExecution asserts invalidExecutionError.
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 ¶
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) ExistsInScoredSet ¶
func (*Service) GetElementsByScore ¶
func (*Service) GetHighestScoredElements ¶
func (*Service) GetRandomFromScoredSet ¶
func (*Service) GetScoreOfElement ¶
func (*Service) GetStringMap ¶
func (*Service) IncrementScoredElement ¶
func (*Service) RemoveScoredElement ¶
func (*Service) SetElementByScore ¶
func (*Service) SetStringMap ¶
func (*Service) WalkScoredSet ¶
Click to show internal directories.
Click to hide internal directories.