cache

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 6 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 {
	// contains filtered or unexported fields
}

Cache is an in-memory key-value cache

func New

func New(size int, dbstore transientDB) *Cache

New return a new in-memory key-value cache

func (*Cache) Close

func (c *Cache) Close()

Close closes the cache

func (*Cache) Get

func (c *Cache) Get(key api.Key) *api.Value

Get returns the transient value for the given key

func (*Cache) Put

func (c *Cache) Put(key api.Key, value []byte, txID string)

Put adds the transient value for the given key.

func (*Cache) PutWithExpire

func (c *Cache) PutWithExpire(key api.Key, value []byte, txID string, expiry time.Duration)

PutWithExpire adds the transient value for the given key.

Jump to

Keyboard shortcuts

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