store

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 2 Imported by: 0

README

store

易用的链式存储kv store
避免在缓存与持久化里沉沦, 减少心智负担
read
-> memory
    -> redis
        -> [kvdb/asw s3]

write
-> [kvdb/asw s3]
    -> redis
        -> memory

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitStore

func InitStore(bucket string, store Store)

Types

type KeysInfo added in v1.0.1

type KeysInfo struct {
	Key  string
	Size int64
}

type KeysInfoSlice added in v1.0.1

type KeysInfoSlice []KeysInfo

func (KeysInfoSlice) ToKeys added in v1.0.1

func (s KeysInfoSlice) ToKeys() (result []string)

type StSlice

type StSlice []Store

func (StSlice) Range

func (s StSlice) Range(cb func(Store) bool)

func (StSlice) RevRange

func (s StSlice) RevRange(cb func(Store) bool)

type Store

type Store interface {
	Close() error
	Put(key string, value []byte) error
	PutTTL(key string, value []byte, ttl time.Duration) error
	Get(key string) ([]byte, error)

	TTL(key string) (time.Duration, error)

	RPut(key string, r io.Reader, size int64) error
	RPutTTL(key string, r io.Reader, size int64, ttl time.Duration) error
	RGet(key string) (io.Reader, error)

	Exist(key string) (bool, error)
	Delete(key string) error

	RangeKeys(prefix, limit string, max int) (KeysInfoSlice, error)
	Range(prefix, limit string, cb func(key string, value []byte) bool) error
	RRange(prefix, limit string, cb func(key string, r io.Reader) bool) error
}

func Get

func Get(bucket string) Store

func NewChain

func NewChain(store ...Store) Store

NewChain 存储链

Directories

Path Synopsis
example
kv
store

Jump to

Keyboard shortcuts

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