assetcache

package
v0.0.0-...-3425628 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2012 License: ISC Imports: 5 Imported by: 1

Documentation

Overview

Package assetcache provides a caching asset handler for static assets. If the asset is not in memory, assetcache will cache it for faster access.

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxItems        = 128
	MaxExpire       = 2592000 // 30 days in seconds
	MaxSize   int64 = 2 * filecache.Megabyte
	Every           = 3600
)

The cache is pre-configured to store up to 128 2MB sized items for up to 30 days, checking every hour for expired items.

Functions

func AssetHandler

func AssetHandler(ac *AssetCache) webshell.RouteHandler

AssetHandler returns an HTTP handler for the given AssetCache. It is suitable for use in the WebApp.AddRoute method.

func BackgroundAttachAssetCache

func BackgroundAttachAssetCache(app *webshell.WebApp, route, path string) (err error)

BackgroundAttachAssetCache will transparently set up an asset cache for a WebApp.

Types

type AssetCache

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

Type AssetCache represents a file cache for static assets.

func CreateAssetCache

func CreateAssetCache(route, path string) *AssetCache

CreateAssetCache creates a basic static asset cache.

func (*AssetCache) IsRunning

func (ac *AssetCache) IsRunning() bool

IsRunning indicates whether the cache is active.

func (*AssetCache) Start

func (ac *AssetCache) Start() error

Start performs the necessary cache startup initialisation, and starts it. The cache must have been created already.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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