redis

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

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

CacheService holds aggregates in Redis.

func NewCacheService

func NewCacheService() *CacheService

NewCacheService creates a new CacheService

func (*CacheService) Close

func (s *CacheService) Close() error

Close closes then underlying Redis database.

func (*CacheService) DB added in v0.4.0

func (s *CacheService) DB() interface{}

DB returns db connection

func (*CacheService) Get

func (s *CacheService) Get(ctx context.Context, aggregateID string, out *hippo.Aggregate) error

Get returns aggregate data for the respective aggregateID. State is unmarshaled to it's original form.

func (s *CacheService) Link(conf Config) error

Link connects and pings the Redis database.

func (*CacheService) Set

func (s *CacheService) Set(ctx context.Context, aggregateID string, in *hippo.Aggregate) error

Set stores aggregate has a form of hash key in Redis. Aggregate State is marshaled into string.

type Config

type Config struct {
	// Addr should be of the form "host:port", defaults to "localhost:6379"
	Addr string

	// Password is the Redis password, optional.
	Password string

	// Database to be used in Redis, defaults to 0
	Database int
}

Config represents a configuration to initialize a new Redis

Jump to

Keyboard shortcuts

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