redis

package
v0.0.0-...-4cdcb29 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 4 Imported by: 0

README

Redis Cart Storage Module

This module offers an implementation of the CartStorage interface using Redis.

Note that by adding this module the default InMemoryStorage binding is overwritten and a running Redis is expected. This can be disabled again via a configuration flag.

Usage

Configurations

For all possible configurations you can check the module.go (CueConfig function) As always you can also dump the current configuration with the "config" Flamingo command.

Here is a typical configuration

  commerce.contrib.cart.redis:
    # enables the module by binding the concrete implementations
    # if set to true a running redis is expected
    enabled: true
    # prefix for keys used to store carts in the redis database
    # will be suffixed with the ID of the cart to be stored
    keyPrefix: "cart:"
    # time to live for entries in the redis database, can differ for guests and logged-in customers
    ttl: 
      guest: "24h"
      customer: "168h"
    # address of the redis  
    address: "example.com:6379"
    # network type, either tcp or unix
    network: "tcp"
    # password of the redis
    password: "pass"
    # maximum number of socket connections
    idleConnections: 10
    # database to be selected of the redis
    database: 0
    # if TLS should be negotiated
    tls: false
Serialization

By default, the carts are serialized using gob. For other forms of serialization it is possible to reimplement the CartSerializer interface and overwrite the binding.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

Module for a cart storage using redis

func (*Module) Configure

func (m *Module) Configure(injector *dingo.Injector)

Configure module

func (*Module) CueConfig

func (*Module) CueConfig() string

CueConfig defines the cart module configuration

func (*Module) Inject

func (m *Module) Inject(
	config *struct {
		Enabled bool `inject:"config:commerce.contrib.cart.redis.enabled"`
	})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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