renderer

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatCacheDir

func FormatCacheDir(dukkhaCacheDir, rendererName string) string

Types

type Cache

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

func NewCache

func NewCache(limit int64, expiry time.Duration) *Cache

func (*Cache) Get

func (c *Cache) Get(key string, refresh CacheRefreshFunc) ([]byte, error)

type CacheConfig

type CacheConfig struct {
	rs.BaseField `yaml:"-"`

	// EnableCache activates caching support
	// for renderers with remote fetch, it will cache it on local disk
	// and cache_size_limit is not effective in that case
	//
	// Defaults to false
	EnableCache bool `yaml:"enable_cache"`

	// CacheSizeLimit limits maximum in memory size of cache
	CacheSizeLimit utils.Size `yaml:"cache_size_limit"`

	// CacheMaxAge limits maximum data cache time
	CacheMaxAge time.Duration `yaml:"cache_max_age"`
}

CacheConfig is the config for cache control

type CacheRefreshFunc

type CacheRefreshFunc func(key string) ([]byte, error)

func CreateRefreshFuncForRemote

func CreateRefreshFuncForRemote(
	cacheDir string,
	maxCacheAge time.Duration,
	doRemoteFetch CacheRefreshFunc,
) CacheRefreshFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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