static

package
v0.0.0-...-81fa0a8 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2014 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirCache

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

A DirCache is an http.Handler for serving static files.

Files within the directory are cached; if a file is changed, an inotify mechanism will invalidate the cache.

There is no limit to how much data will be cached.

func Dir

func Dir(dir string) *DirCache

Dir returns a DirCache serving files in the given directory.

func (*DirCache) Close

func (d *DirCache) Close()

Close should be called to clean up the cached resources and stop the inotify watcher if this DirCache is no longer necessary.

func (*DirCache) ServeHTTP

func (d *DirCache) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is part of the http.Handler interface.

func (*DirCache) Strip

func (d *DirCache) Strip(prefix string) *DirCache

Strip causes all requests to strip the given prefix from the request URI.

type FileCache

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

A FileCache is an http.Handler for serving a single static file.

The file's contents will be cached; if the file is changed, an inotify mechanism will invalidate the cache.

There is no limit to how much data will be cached.

func File

func File(file string) *FileCache

File returns an http.Handler for serving a single static file.

func (*FileCache) ServeHTTP

func (f *FileCache) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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