httpcache

package
v0.0.0-...-c936f35 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Package httpcache provides a RoundTripper that stores all responses on disk, and returns cached responses for any requests that have been made before. This package is provided for a very specific purpose, and is unlikely to be widely useful. Be aware of the caveats before using this package:

  • Requests are keyed purely based on the URL. All other data from the request are ignored, which includes headers, POST data, and even query parameters.
  • Responses are cached *forever* (until manually deleted).

This cache is useful for quickly prototyping bar customisations. By replacing the Transport of http.DefaultClient (or replacing http.DefaultTransport), the resulting binary will no longer make real HTTP requests when started, so it can be rebuilt and restarted hundreds of times without counting towards any quota.

The cache is located at ~/.cache/barista/http (using XDG_CACHE_HOME for ~/.cache if set). Individual responses can be deleted if a fresher copy is needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(transport http.RoundTripper) http.RoundTripper

Wrap creates a new caching http.RoundTripper that uses the given RoundTripper to fetch responses that don't yet exist in the cache.

Types

This section is empty.

Jump to

Keyboard shortcuts

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