mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
tpl: Add templates.Current
This commit also * Unexport all internal state in TemplateInfo. * Make the dispatcher keys used for passing context.Context into uint8 from string to save memory allocations. Co-authored-by: Joe Mooring <joe@mooring.com> Updates #13571
This commit is contained in:
@@ -55,12 +55,16 @@ type Client struct {
|
||||
remoteResourceLogger logg.LevelLogger
|
||||
}
|
||||
|
||||
type contextKey string
|
||||
type contextKey uint8
|
||||
|
||||
const (
|
||||
contextKeyResourceID contextKey = iota
|
||||
)
|
||||
|
||||
// New creates a new Client with the given specification.
|
||||
func New(rs *resources.Spec) *Client {
|
||||
fileCache := rs.FileCaches.GetResourceCache()
|
||||
resourceIDDispatcher := hcontext.NewContextDispatcher[string](contextKey("resourceID"))
|
||||
resourceIDDispatcher := hcontext.NewContextDispatcher[string](contextKeyResourceID)
|
||||
httpCacheConfig := rs.Cfg.GetConfigSection("httpCacheCompiled").(hhttpcache.ConfigCompiled)
|
||||
var remoteResourceChecker *tasks.RunEvery
|
||||
if rs.Cfg.Watching() && !httpCacheConfig.IsPollingDisabled() {
|
||||
|
Reference in New Issue
Block a user