cache

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 8 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSON

type JSON struct {
	Dir   string                `json:"dir"`
	Files map[string]*cacheFile `json:"files"`
	// contains filtered or unexported fields
}

JSON implements sts.FileCache for making a local cache of file info

func NewJSON

func NewJSON(cacheDir, fileRoot, key string) (j *JSON, err error)

NewJSON initializes the cache

func (*JSON) Add

func (j *JSON) Add(file sts.Hashed)

Add adds a hashed file to the in-memory cache

func (*JSON) Done

func (j *JSON) Done(key string, whileLocked func(sts.Cached))

Done marks the file by the given key as done

func (*JSON) Get

func (j *JSON) Get(key string) sts.Cached

Get returns the stored file with the specified key

func (*JSON) Iterate

func (j *JSON) Iterate(f func(sts.Cached) bool)

Iterate iterates over the cache and calls provided callback on each file

func (*JSON) Persist

func (j *JSON) Persist() (err error)

Persist writes the in-memory cache to disk

func (*JSON) Remove

func (j *JSON) Remove(key string)

Remove removes the file by the specified key from the in-memory cache

func (*JSON) Reset

func (j *JSON) Reset(key string)

Reset clears the hash

Jump to

Keyboard shortcuts

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