cache

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("item not found")
)

Functions

This section is empty.

Types

type Cache

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

func New added in v0.27.0

func New(dbPath string) (*Cache, error)

New returns a new Cache that stores its data in dbPath.

func (*Cache) Delete added in v0.27.0

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

Delete deletes the item identified by key in the cache.

func (*Cache) DeleteAllByTag added in v0.27.0

func (c *Cache) DeleteAllByTag(tagName string) error

DeleteAllByTag deletes all items in the cache that have been tagged by tagName. Deletes an item even if multiple tags refer to it.

func (*Cache) Get added in v0.27.0

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

Get returns the item identified by key from the cache. It returns ErrNotFound if the item doesn't exist in the cache.

func (*Cache) GetAllByTag added in v0.27.0

func (c *Cache) GetAllByTag(tag string) ([][]byte, error)

GetAllByTag returns the values of all items tagged with tag.

func (*Cache) Set added in v0.27.0

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

Set writes the item identified by key with value to the cache.

func (*Cache) SetWithTags added in v0.27.0

func (c *Cache) SetWithTags(key string, value []byte, tags ...string) error

SetWithTags adds the item identified by key with value to the cache. One or more tags can be passed to tag the item.

Jump to

Keyboard shortcuts

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