contextstore

package
v0.0.0-...-bb92df6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: OSL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNoRedisConnection is returned if the underlying connection is erroneous
	ErrNoRedisConnection = errors.New("no redis connection, see healthcheck")
)

Functions

This section is empty.

Types

type Memory

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

Memory saves all contexts in a simple map

func (*Memory) Delete

func (m *Memory) Delete(_ context.Context, key string) error

Delete a stored context, nop if it doesn't exist

func (*Memory) Get

func (m *Memory) Get(_ context.Context, key string) (process.Context, bool)

Get a stored context

func (*Memory) Inject

func (m *Memory) Inject() *Memory

Inject dependencies

func (*Memory) Store

func (m *Memory) Store(_ context.Context, key string, value process.Context) error

Store a given context

type Redis

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

Redis saves all contexts in a simple map

func (*Redis) Delete

func (r *Redis) Delete(ctx context.Context, key string) error

Delete a stored context, nop if it doesn't exist

func (*Redis) Get

func (r *Redis) Get(ctx context.Context, key string) (process.Context, bool)

Get a stored context

func (*Redis) Inject

func (r *Redis) Inject(
	logger flamingo.Logger,
	cfg *struct {
		MaxIdle                 int    `inject:"config:commerce.checkout.placeorder.contextstore.redis.maxIdle"`
		IdleTimeoutMilliseconds int    `inject:"config:commerce.checkout.placeorder.contextstore.redis.idleTimeoutMilliseconds"`
		Network                 string `inject:"config:commerce.checkout.placeorder.contextstore.redis.network"`
		Address                 string `inject:"config:commerce.checkout.placeorder.contextstore.redis.address"`
		Database                int    `inject:"config:commerce.checkout.placeorder.contextstore.redis.database"`
	}) *Redis

Inject dependencies

func (*Redis) Status

func (r *Redis) Status() (alive bool, details string)

Status handles the health check of redis

func (*Redis) Store

func (r *Redis) Store(ctx context.Context, key string, placeOrderContext process.Context) error

Store a given context

Jump to

Keyboard shortcuts

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