memoryDB

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMemoryDB

type IMemoryDB interface {
	GetData(key string) (any, bool)
	SetData(key string, value any)
	SetDataWithTTL(key string, value any, ttl time.Duration)
	Remove(key string)

	AddConnection(id string)
	RemoveConnection(id string)
	GetAllConnection() (ids []string)
	CountConnection() int
}

type MemoryDb

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

func NewMemoryDb

func NewMemoryDb(ctx context.Context, dataTTL time.Duration) *MemoryDb

func (*MemoryDb) AddConnection

func (db *MemoryDb) AddConnection(id string)

func (*MemoryDb) CountConnection

func (db *MemoryDb) CountConnection() int

func (*MemoryDb) GetAllConnection

func (db *MemoryDb) GetAllConnection() (ids []string)

func (*MemoryDb) GetData

func (db *MemoryDb) GetData(key string) (any, bool)

func (*MemoryDb) Remove

func (db *MemoryDb) Remove(key string)

func (*MemoryDb) RemoveConnection

func (db *MemoryDb) RemoveConnection(id string)

func (*MemoryDb) Run

func (db *MemoryDb) Run(ctx context.Context)

func (*MemoryDb) SetData

func (db *MemoryDb) SetData(key string, value any)

func (*MemoryDb) SetDataWithTTL added in v1.0.4

func (db *MemoryDb) SetDataWithTTL(key string, value any, ttl time.Duration)

Jump to

Keyboard shortcuts

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