cached

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxPartCashSize  = 1024 * 1024 * 100
	MaxValueCashSize = 1024 * 1024 * 50
	DATABASE         = map[string]*Data{}
)

Functions

This section is empty.

Types

type Data

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

func Connect

func Connect(path string) (*Data, error)

Connect init data

func (*Data) Add

func (data *Data) Add(key string, value []byte) error

Add value by key

func (*Data) AddWithTTL

func (data *Data) AddWithTTL(key string, value []byte, ttl time.Duration) error

func (*Data) Exist

func (data *Data) Exist(key string) ([]byte, error)

Exist validate key

func (*Data) Get

func (data *Data) Get(key string) ([]byte, error)

Get value by key

func (*Data) GetAll

func (data *Data) GetAll() (map[string][]byte, error)

GetAll get all values

func (*Data) GetValues

func (data *Data) GetValues() (<-chan Item, error)

func (*Data) Remove

func (data *Data) Remove(key string) error

Remove value by key

type Item

type Item struct {
	Key   []byte
	Value []byte
}

Jump to

Keyboard shortcuts

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