fscache

package
v0.0.0-...-4b9bf86 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package fscache represents a file data cache based on an FsInfo

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache(inp <-chan *fs.FsFile) <-chan *FsCache

Cache launches a inp listener and returns a channel to receive a new populated FsCache (like a done channel) upon close of inp.

Types

type FsCache

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

FsCache provides cached file data for any *fs.FsFile

func New

func New() *FsCache

New returns a fresh FsCache, ready to be populated via Register, or via Done (listening to a channel where FsPath'es are supplied), and subsequently queried via Lookup or LookupData.

func (*FsCache) Done

func (fi *FsCache) Done(inp <-chan *fs.FsFile) <-chan struct{}

Done launches a inp listener and returns a done channel

Note: while listening, the FsCache is Locked,
and any error upon registration is silently ignored

func (*FsCache) Lookup

func (fi *FsCache) Lookup(key *fs.FsFile) (*fs.FsData, bool)

Lookup returns the FsData object assigned to key (if any) or false

func (*FsCache) LookupData

func (fi *FsCache) LookupData(key *fs.FsFile) string

LookupData returns the data assigned to the FsData of key (or an empty string)

func (*FsCache) Register

func (fi *FsCache) Register(key *fs.FsFile) error

Register a key in the FsCache; related data is refreshed, if underlying os.FileInfo has changed.

Jump to

Keyboard shortcuts

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