cache

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltDBCache

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

BoltDBCache is a BoltDB backed key-value store.

func BoltDB

func BoltDB(filepath string) (*BoltDBCache, error)

BoltDB returns a BoltDBCache, which is BoltDB backed key-value store.

func (*BoltDBCache) Close

func (c *BoltDBCache) Close() error

Close releases all database resources.

func (*BoltDBCache) Get

func (c *BoltDBCache) Get(key []byte) (value []byte, ok bool, err error)

Get retrieves a key-value pair from the cache.

func (*BoltDBCache) Set

func (c *BoltDBCache) Set(key []byte, value []byte) error

Set adds a key-value pair to the cache.

type MemoryCache

type MemoryCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MemoryCache is a simple, thread-safe in-memory key-value store.

func Memory

func Memory() *MemoryCache

Memory returns a MemoryCache, which is a simple, thread-safe in-memory key-value store.

func (*MemoryCache) Get

func (c *MemoryCache) Get(key []byte) (value []byte, ok bool, err error)

func (*MemoryCache) Set

func (c *MemoryCache) Set(key []byte, value []byte) error

Jump to

Keyboard shortcuts

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