cache

package
v0.0.0-...-e488709 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {

	// Bytes serializes objects before they go into storage. Users are required to define this one
	Bytes func(k string, v interface{}) []byte
	// FromBytes deserializes object coming from storage. Users are required to define this one
	FromBytes func(k string, v []byte) interface{}
	// New creates a new object when there's no object in cache or storage. Optional
	New func(k string) interface{}
	// contains filtered or unexported fields
}

func New

func New(db *badger.DB, bound int, prefix string) *Cache

func (*Cache) Flush

func (cache *Cache) Flush()

func (*Cache) Get

func (cache *Cache) Get(key string) interface{}

func (*Cache) Put

func (cache *Cache) Put(key string, val interface{})

Jump to

Keyboard shortcuts

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