file

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package file implements a file-backed cache

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileCache

func NewFileCache(dir string) (cache.Cache, error)

NewFileCache creates an cached backed by a directory

func NewTempFileCache

func NewTempFileCache() (cache.Cache, error)

NewTempFileCache creates a file cache using a temporary file

Types

type Cache

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

Cache a Cache backed by a file system

func (*Cache) Download

func (f *Cache) Download(_ context.Context, object cache.Object) (io.ReadCloser, error)

Download returns the content of the object given its url

func (*Cache) Get

func (f *Cache) Get(_ context.Context, id string) (cache.Object, error)

Get retrieves an objects if exists in the cache or an error otherwise

func (*Cache) Store

func (f *Cache) Store(_ context.Context, id string, content io.Reader) (cache.Object, error)

Store stores the object and returns the metadata

Jump to

Keyboard shortcuts

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