cache

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

Repository keeps a copy of the data from the remote location on the local filesystem. It implements the tldr.Repository to provide quick access to the requested markdown.

func NewRepository

func NewRepository(remote string, ttl time.Duration) (*Repository, error)

NewRepository returns a new cache repository. The data is loaded from the remote if missing or stale.

func (*Repository) AvailablePlatforms

func (r *Repository) AvailablePlatforms() ([]string, error)

AvailablePlatforms returns all the availale platforms found in cache.

func (*Repository) Markdown

func (r *Repository) Markdown(platform, page string) (io.ReadCloser, error)

Markdown pulls the markdown from the page in cache.

func (*Repository) Pages

func (r *Repository) Pages() ([]string, error)

Pages returns all the pages for the given platform.

func (*Repository) Reload

func (r *Repository) Reload() error

Reload removes the cache directory, recreates it, and saves the data from the remote to the local filesystem.

Jump to

Keyboard shortcuts

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