memory_Engine

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

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

MemoryStorage is a simple in-memory storage engine

func NewMemoryStorage

func NewMemoryStorage(logger *slog.Logger, name string, maxEntries int) (*MemoryStorage, error)

NewMemoryStorage creates a new MemoryStorage object

func (*MemoryStorage) Close

func (m *MemoryStorage) Close() error

Close closes the database

func (*MemoryStorage) GetBytes

func (m *MemoryStorage) GetBytes(identifier string, key key.Key) ([]byte, error)

GetBytes gets a value from the database using a byte key

func (*MemoryStorage) GetBytesSafe

func (m *MemoryStorage) GetBytesSafe(identifier string, key key.Key) ([]byte, error)

GetBytesSafe attempts to get a value from the database, and returns nil if not found

func (*MemoryStorage) GetDBFileName

func (m *MemoryStorage) GetDBFileName() string

GetDBFileName returns the on-disk filename of the database

func (*MemoryStorage) Len added in v2.4.0

func (m *MemoryStorage) Len() int

Len returns the number of items currently in the cache

func (*MemoryStorage) SetBytes

func (m *MemoryStorage) SetBytes(_ string, key key.Key, value []byte) error

SetBytes sets a value in the database using a byte key

Jump to

Keyboard shortcuts

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