cache

package
v0.0.0-...-6ad305b Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

all things templating, cached

Index

Constants

This section is empty.

Variables

View Source
var ErrorCacheBroken = errors.New("Something went wrong with the cache, please recreate the cache")
View Source
var ErrorCacheClosed = errors.New("called Frame with closed cache")

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Close()
	Frame(first bool, frameId int, timeNow time.Time, screenId int, screenGroup int, errorMessage string) (code ReturnCode, frame string, err error)
}

func LocalCache

func LocalCache(db *sql.DB, config *Config) Cache

type Config

type Config struct {
	UseHtmlTemplate              bool           `json:"useHtmlTemplate"`              // if the values to enter in templates should be escaped or not.  — https://pkg.go.dev/html/template (true), https://pkg.go.dev/text/template (false)
	DEVOverrideCacheModes        bool           `json:"DEVoverrideCacheModes"`        // If arbitrary overrides of CacheModes is allowed
	FrameContentTypeUrlCacheMode FrameCacheMode `json:"frameContentTypeUrlCacheMode"` // If for a frame the ContentType is set to url, which Cache Mode should be used
	CacheRefresh                 time.Duration  `json:"cacheRefresh"`                 // How often the cache should be refreshed
	CachePurge                   time.Duration  `json:"cachePurge"`                   // After how long of no access of a frame it should be wiped from cache
}

type FrameCacheMode

type FrameCacheMode int

How a frame should be cached (don't change values, used in config)

const (
	Never  FrameCacheMode = 1 //never cache
	Loop   FrameCacheMode = 2 //cache every loop
	Always FrameCacheMode = 3 //always cache

)

type ReturnCode

type ReturnCode int

return codes for Frame

const (
	Success  ReturnCode = iota //Return content to be sent to the screen
	Error                      //error happened
	NoChange                   //just send ping
)

Jump to

Keyboard shortcuts

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