db

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const FileName = "goscrape-etags.txt"

Variables

This section is empty.

Functions

func DeleteFile

func DeleteFile(fs afero.Fs)

Types

type DB

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

DB provides a persistent store for HTTP ETags to reduce network traffic when repeating a download session. If the store is unavailable for some reason, its methods are no-ops.

func Open

func Open() *DB

func OpenDB

func OpenDB(dir string, fs afero.Fs) *DB

func (*DB) Close

func (store *DB) Close() error

func (*DB) Lookup

func (store *DB) Lookup(u *urlpkg.URL) Item

Lookup finds the ETags for a given URL.

func (*DB) Store

func (store *DB) Store(u *urlpkg.URL, item Item)

Store stores the ETags for a given URL.

type Item

type Item struct {
	ETags   string
	Expires time.Time
}

func (Item) Empty

func (i Item) Empty() bool

func (Item) String

func (i Item) String() string

Jump to

Keyboard shortcuts

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