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.
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.
Click to show internal directories.
Click to hide internal directories.