cache

package
v3.9.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// Get retrieves v from Backend. The returned v may be the original value. The caller should
	// not modify it.
	Get(key string) (v []byte, storedTime, expirationTime time.Time)

	// Store stores a copy of v into Backend. v cannot be nil.
	// If expirationTime is already passed, Store is a noop.
	Store(key string, v []byte, storedTime, expirationTime time.Time)

	// Closer closes the cache backend. Get and Store should become noop calls.
	io.Closer
}

Backend represents a cache backend. The Backend does not raise errors cause a cache error is not a fatal error to a dns query. The caller usually does not care too much about the cache error. Implements should handle errors themselves. Cache Backend is expected to be very fast. All operations should be done (or returned) in a short time. e.g. 50 ms.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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