cache

package
v2.20.0-test.4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteFromUserCache

func DeleteFromUserCache(ctx context.Context, file string) error

func DeleteIngressesFromUserCache

func DeleteIngressesFromUserCache(ctx context.Context) error

DeleteIngressesFromUserCache removes the ingresses cache if exists or returns an error. An attempt to remove a non-existing cache is a no-op and the function returns nil.

func ExistsInCache added in v2.11.0

func ExistsInCache(ctx context.Context, fileName string) (bool, error)

func LoadFromUserCache

func LoadFromUserCache(ctx context.Context, dest any, file string) error

func LoadIngressesFromUserCache

func LoadIngressesFromUserCache(ctx context.Context) (map[string]*manager.IngressInfo, error)

LoadIngressesFromUserCache gets the ingresses from cache. An empty map is returned if the file does not exist. An error is returned if something goes wrong while loading or unmarshalling.

func SaveIngressesToUserCache

func SaveIngressesToUserCache(ctx context.Context, ingresses map[string]*manager.IngressInfo) error

SaveIngressesToUserCache saves the provided ingresses to user cache and returns an error if something goes wrong while marshalling or persisting.

func SaveToUserCache

func SaveToUserCache(ctx context.Context, object any, file string, perm Permissions) error

func WatchUserCache added in v2.12.0

func WatchUserCache(ctx context.Context, subDir string, onChange func(context.Context) error, files ...string) error

WatchUserCache uses a file system watcher that receives events when one of the given files changes and calls the given function when that happens. All files in the given subDir are watched when the list of files is empty.

Types

type Permissions added in v2.16.0

type Permissions fs.FileMode
const (
	Public  Permissions = 0o644
	Private Permissions = 0o600
)

Jump to

Keyboard shortcuts

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