Help us shape the future of Go! Take the 2026 Go Developer Survey

cache

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTTL is the default time-to-live for cache entries
	DefaultTTL = 60 * time.Second

	// CacheDir is the directory where cache files are stored
	CacheDir = ".cache/gh-arc"
)

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(components ...string) string

GenerateKey creates a cache key from components

Types

type Cache

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

Cache represents a filesystem-based cache

func New

func New() (*Cache, error)

New creates a new cache instance

func (*Cache) CleanExpired

func (c *Cache) CleanExpired() error

CleanExpired removes expired cache entries

func (*Cache) Clear

func (c *Cache) Clear() error

Clear removes all cache entries

func (*Cache) Delete

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

Delete removes a cache entry

func (*Cache) Get

func (c *Cache) Get(key string, v interface{}) (bool, error)

Get retrieves a cached item by key

func (*Cache) Set

func (c *Cache) Set(key string, v interface{}) error

Set stores an item in the cache

func (*Cache) SetTTL

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

SetTTL sets the time-to-live for cache entries

type CacheEntry

type CacheEntry struct {
	Data      json.RawMessage `json:"data"`
	CreatedAt time.Time       `json:"created_at"`
	ExpiresAt time.Time       `json:"expires_at"`
}

CacheEntry represents a cached item with metadata

Jump to

Keyboard shortcuts

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