redis

package module
v0.0.0-...-6f5578f Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package redis contains redis storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

func NewStorage

func NewStorage(client *redis.Client, pref StorageSettings) *Storage

NewStorage returns new redis storage.

func (*Storage) Close

func (s *Storage) Close() error

func (*Storage) GetData

func (s *Storage) GetData(chatId, userId int64, key string, to interface{}) error

func (*Storage) GetState

func (s *Storage) GetState(chatId, userId int64) (fsm.State, error)

func (*Storage) ResetState

func (s *Storage) ResetState(chatId, userId int64, withData bool) error

func (*Storage) SetState

func (s *Storage) SetState(chatId, userId int64, state fsm.State) error

func (*Storage) UpdateData

func (s *Storage) UpdateData(chatId, userId int64, key string, data interface{}) error

type StorageSettings

type StorageSettings struct {
	// Prefix for records in Redis.
	// Default is "fsm".
	Prefix string

	// TTL for state.
	// Default is 0 (no ttl).
	TTLState time.Duration

	// TTL for state data.
	// Default is 0 (no ttl).
	TTLData time.Duration

	// Batch size for reset data.
	// Default is 0 (no batching).
	ResetDataBatchSize int64
}

Jump to

Keyboard shortcuts

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