cache

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTTL = 24 * time.Hour

DefaultTTL is the default time-to-live for cache entries.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

DefaultPath returns the default cache file path (~/.gogitup.cache).

func IsExpired

func IsExpired(entry Entry, ttl time.Duration) bool

IsExpired checks if a cache entry is older than the given TTL.

func Remove

func Remove(c *Cache, name string)

Remove removes the cache entry for the given app name.

func Save

func Save(path string, c *Cache) error

Save writes the cache to the given file path.

func Set

func Set(c *Cache, name string, version string)

Set sets the cache entry for the given app name with the current time.

Types

type Cache

type Cache struct {
	Entries map[string]Entry `yaml:"entries"`
}

Cache represents the gogitup cache file.

func Load

func Load(path string) (*Cache, error)

Load reads and parses the cache file at the given path. If the file does not exist, an empty Cache is returned without error.

type Entry

type Entry struct {
	LatestVersion string    `yaml:"latest_version"`
	CheckedAt     time.Time `yaml:"checked_at"`
}

Entry represents a cached version check result for an application.

func Get

func Get(c *Cache, name string) (Entry, bool)

Get returns the cache entry for the given app name and whether it was found.

Jump to

Keyboard shortcuts

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