cache

package module
v0.0.0-...-8dd287f Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 15 Imported by: 3

README

cache

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateListener

func CreateListener(source chan []byte) *listeners

func GetMtime

func GetMtime(path string) (time.Time, error)

func WaitForCurrent

func WaitForCurrent(v Version) []byte

Types

type CacheableFunction

type CacheableFunction func(stdout io.Writer, stderr io.Writer, abort chan []byte) (result []byte, err error)

type Cacher

type Cacher interface {
	Cache(hasher hash.Hash, wrapped CacheableFunction, versioner Version) ([]byte, error)
	SetMaximumDuration(d time.Duration)
}

func Create

func Create(name string) Cacher

type Reactive

type Reactive func() ([]byte, error)

This type is used when you don't really care about being

notified on changes; it's sufficient to be able to get
the current value on demand.

func Identity

func Identity() Reactive

Use when there is only one version

func Static

func Static(f func() ([]byte, error)) Reactive

Use to provide a version which will not change

func (Reactive) CancelNotifyOnChange

func (r Reactive) CancelNotifyOnChange(i int)

func (Reactive) Current

func (r Reactive) Current() []byte

func (Reactive) NotifyOnChange

func (r Reactive) NotifyOnChange(initial []byte, onChanged chan []byte) int

type Version

type Version interface {
	Current() []byte
	NotifyOnChange(initial []byte, onChanged chan []byte) int
	CancelNotifyOnChange(i int)
}

func CreateHybrid

func CreateHybrid(current Reactive, abort Version) Version

func CreateNullVersion

func CreateNullVersion() Version

Jump to

Keyboard shortcuts

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