db

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const FileName = "goscrape-cache.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 and other metadata 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 metadata for a given URL.

func (*DB) Store

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

Store stores the metadata for a given URL.

type Item

type Item struct {
	Code     int
	Location string // redirection
	Content  header.ContentType
	ETags    string
	Expires  time.Time
}

func (Item) Empty

func (i Item) Empty() bool

func (Item) EmptyContentType added in v1.4.0

func (i Item) EmptyContentType() bool

func (Item) String

func (i Item) String() string

func (Item) Strings added in v1.5.2

func (i Item) Strings() []string

Jump to

Keyboard shortcuts

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