cache

package
v0.0.0-...-033bb3f Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 2

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
}

func New

func New(opts ...Option) *Cache

func (*Cache) Read

func (c *Cache) Read(key string) ([]byte, error)

func (*Cache) ReadAny

func (c *Cache) ReadAny(key string, output any) error

The second argument must be a reference to the a variable of the stored type Ex: output := []Mystruct{}

err := c.ReadAny("TEST_KEY", &output)

func (*Cache) ReadStrings

func (c *Cache) ReadStrings(key string) ([]string, error)

Uses `\n` as delimiter

func (*Cache) ReadUint64

func (c *Cache) ReadUint64(key string) (uint64, error)

func (*Cache) Remove

func (c *Cache) Remove(key string) error

func (*Cache) RemoveAll

func (c *Cache) RemoveAll() error

func (*Cache) Store

func (c *Cache) Store(key string, value []byte) error

func (*Cache) StoreAny

func (c *Cache) StoreAny(key string, value any) error

Only exported fields of an struct are stored

func (*Cache) StoreStrings

func (c *Cache) StoreStrings(key string, value []string) error

Uses `\n` as delimiter

func (*Cache) StoreUint64

func (c *Cache) StoreUint64(key string, value uint64) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithStorePath

func WithStorePath(path string) Option

Jump to

Keyboard shortcuts

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