fscache

package module
v0.0.0-...-c08ebf7 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 8 Imported by: 0

README

go-fscache

Package fscache provides caching "middleware" for a fs.FS, for the Go programming language.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/codeberg.org/reiver/go-fscache

GoDoc

Example

Here is an example:

import "codeberg.org/reiver/go-fscache"

// ...

var filesys fs.FS = ???

// ...

var ttl time.Duration = 2 * time.Hour

filesys = fscache.Wrap(ttl, filesys)

Import

To import package fscache use import code like the following:

import "codeberg.org/reiver/go-fscache"

Installation

To install package fscache do the following:

GOPROXY=direct go get codeberg.org/reiver/go-fscache

Author

Package fscache was written by Charles Iliya Krempeaux

Documentation

Index

Constants

View Source
const (
	ErrNotFound = erorr.Error("fscache: not found")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedFS

type CachedFS interface {
	fs.FS
	TTL(string) (time.Duration, bool)
	Span() int
	Unwrap() fs.FS
	Vacuum()
}

CachedFS reprsents a fs.FS that is caching another fs.FS.

func Wrap

func Wrap(ttl time.Duration, filesys fs.FS) CachedFS

func WrapWithLogger

func WrapWithLogger(logger log.Logger, ttl time.Duration, filesys fs.FS) CachedFS

type LoggingFS

type LoggingFS interface {
	fs.FS
	LoggingOpener
}

type LoggingOpener

type LoggingOpener interface {
	OpenAndLog(log.Logger, string) (fs.File, error)
}

Jump to

Keyboard shortcuts

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