store

package
v0.0.0-...-36d655e Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotExisted     string = "data not existed"
	ErrModeNotMatched string = "storage mode not matched"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LevelStore

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

func NewLevelStore

func NewLevelStore(path string) (*LevelStore, error)

func (*LevelStore) Close

func (l *LevelStore) Close()

func (*LevelStore) Get

func (l *LevelStore) Get(key string) ([]byte, error)

func (*LevelStore) Set

func (l *LevelStore) Set(key string, data []byte) error

type MemStore

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

MemStore 表示一个内存存储

func NewMemStore

func NewMemStore() *MemStore

func (*MemStore) Close

func (m *MemStore) Close()

func (*MemStore) Get

func (m *MemStore) Get(key string) ([]byte, error)

func (*MemStore) Set

func (m *MemStore) Set(key string, data []byte) error

type Storage

type Storage interface {
	Get(key string) ([]byte, error)
	Set(key string, data []byte) error
	Close()
}

Jump to

Keyboard shortcuts

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