filecache

package
v3.0.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFilename

func GetFilename(data []byte) string

Types

type Cache

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

func New

func New(basePath string) Cache

New creates and returns a new file-backed data caching instance.

func (Cache) AddFile

func (c Cache) AddFile(data []byte) string

AddFile saves the given data to a file in HOME/files directory using sha256 sum as filename.

func (Cache) GetFile

func (c Cache) GetFile(filename string) ([]byte, error)

GetFile loads the file from the file storage. Returns error if the file does not exist.

func (Cache) MustGetFile

func (c Cache) MustGetFile(filename string) []byte

MustGetFile loads the file from the file storage. Panics if the file does not exist.

Jump to

Keyboard shortcuts

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