cache

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

package cache provides a thread-safe key-value interface for persisting data to disk. Ideal use case is for caching data that is expensive to compute in devtools and unlikely to change. Do NOT use it to store sensitive information.

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(path string, opts ...Option) (*Cache, error)

func (*Cache) Close added in v0.0.3

func (c *Cache) Close() error

func (*Cache) DeleteAll

func (c *Cache) DeleteAll() error

func (*Cache) DeleteKey

func (c *Cache) DeleteKey(subpath, key string) error

func (*Cache) DeleteSubpath

func (c *Cache) DeleteSubpath(subpath string) error

func (*Cache) Keys

func (c *Cache) Keys(subpath string) (iter.Seq[string], error)

func (*Cache) Load

func (c *Cache) Load(subpath, key string, dst any) (bool, error)

Loads data from path/subpath and stores in dst

func (*Cache) Store

func (c *Cache) Store(subpath, key string, data any) error

type Option added in v0.0.3

type Option func(*Cache) *Cache

func WithPermission added in v0.0.3

func WithPermission(perms uint32) Option

Jump to

Keyboard shortcuts

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