cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectCacheDir = "evansky"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache represents a cache entry. Cache entries are store in user cache directory (see os.UserCacheDir) under ProjectCacheDir. Each cache entry is a folder where the name is the hash of the path. e.g. hash(test) = 098f6bcd4621d373cade4e832627b4f6

./test -> /path/to/cache/098f6bcd4621d373cade4e832627b4f6

func New

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

New return cache entry for given dir directory.

func NewMultiple

func NewMultiple() ([]Cache, error)

NewMultiple return a slice of all available cache entries found.

func (*Cache) Clean

func (c *Cache) Clean() error

Clean remove cached files.

func (*Cache) Dir

func (c *Cache) Dir() string

Dir return the cache directory.

func (*Cache) GetList

func (c *Cache) GetList() (*list.Result, error)

GetList return cached list results.

func (*Cache) GetScan

func (c *Cache) GetScan() (*scan.Results, error)

GetScan return cached scan results.

func (*Cache) Size

func (c *Cache) Size() (int64, error)

Size return cache size in bytes.

func (*Cache) Status

func (c *Cache) Status(checksum string) (status Status, err error)

Status check cache status. e.g. filename=1234/5678

DoNotExist: /cache/path/1234/fileschecksum missing
Changed:    /cache/path/1234/fileschecksum content != checksum
UpToDate:   /cache/path/1234/fileschecksum content == checksum

func (*Cache) StoreList

func (c *Cache) StoreList(result *list.Result) error

StoreList store result under filechecksum file.

func (*Cache) StoreScan

func (c *Cache) StoreScan(results *scan.Results) error

StoreScan store results under scan file.

type Status

type Status string
const (
	DoNotExists Status = "DoNotExists"
	UpToDate    Status = "UpToDate"
	Changed     Status = "Changed"
)

Jump to

Keyboard shortcuts

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