memorydb

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewlruDB

func NewlruDB(size uint32) (*lruDB, error)

NewlruDB creates a lruDB according to size

Types

type DB

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

DB represents the memory database storage. It holds a map of key value pairs and a mutex to handle concurrent accesses to the map

func New

func New() *DB

New creates a new memorydb object

func (*DB) Close

func (s *DB) Close() error

Close closes the files/resources associated to the storage medium

func (*DB) Destroy

func (s *DB) Destroy() error

Destroy removes the storage medium stored data

func (*DB) DestroyClosed

func (s *DB) DestroyClosed() error

DestroyClosed removes the storage medium stored data

func (*DB) Get

func (s *DB) Get(key []byte) ([]byte, error)

Get gets the value associated to the key, or reports an error

func (*DB) Has

func (s *DB) Has(key []byte) error

Has returns true if the given key is present in the persistence medium, false otherwise

func (*DB) IsInterfaceNil

func (s *DB) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*DB) Put

func (s *DB) Put(key, val []byte) error

Put adds the value to the (key, val) storage medium

func (*DB) RangeKeys added in v1.0.138

func (s *DB) RangeKeys(handler func(key []byte, value []byte) bool)

RangeKeys will iterate over all contained (key, value) pairs calling the provided handler

func (*DB) Remove

func (s *DB) Remove(key []byte) error

Remove removes the data associated to the given key

Jump to

Keyboard shortcuts

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