cache

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Overview

Package cache define cache afs.Service to cache read operation for specified URL

Index

Constants

View Source
const CacheFile = "_.cache"

CacheFile cache file

Variables

This section is empty.

Functions

func New

func New(baseURL string, fs afs.Service, opts ...storage.Option) afs.Service

New create a cache service for supplied base URL

func Package added in v1.23.0

func Package(ctx context.Context, sourceURL string, rewriteBaseURL string, options ...storage.Option) error

Package creates cache file for source URL with rewrite

func Singleton

func Singleton(URL string, opts ...storage.Option) afs.Service

Singleton returns caching Service for specified URL

Types

type Cache

type Cache struct {
	URL   string
	Items []*Entry
	At    time.Time
}

Cache represent a cache

type Entries added in v1.23.0

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

func NewEntries added in v1.23.0

func NewEntries(ptr *[]*Entry) *Entries

func (*Entries) Append added in v1.23.0

func (e *Entries) Append(entry *Entry)

type Entry

type Entry struct {
	URL     string
	ModTime time.Time
	Size    int64
	Data    []byte
}

Entry represents cache entry

Jump to

Keyboard shortcuts

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