cache

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultTTL is the default cache time-to-live (24 hours)
	DefaultTTL = 24 * time.Hour
	// CacheDir is the cache directory name
	CacheDir = ".cache/mail-app-cli"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache manages cached data files

func New

func New() (*Cache, error)

New creates a new Cache instance

func (*Cache) Clear

func (c *Cache) Clear() error

Clear removes all cached items

func (*Cache) Delete

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

Delete removes a cached item

func (*Cache) DeletePrefix

func (c *Cache) DeletePrefix(prefix string) error

DeletePrefix removes all cached items whose key starts with the given prefix. Use this to invalidate all query variants for a specific mailbox after a mutation.

func (*Cache) Get

func (c *Cache) Get(key string, v any) (bool, error)

Get retrieves data from cache if it exists and is not stale

func (*Cache) Set

func (c *Cache) Set(key string, v any) error

Set stores data in the cache

func (*Cache) SetTTL

func (c *Cache) SetTTL(ttl time.Duration)

SetTTL sets the cache time-to-live

Jump to

Keyboard shortcuts

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