Unexpected caching with pkl-go and Evaluator.EvaluateOutputText #165

Closed
opened 2025-12-30 01:21:40 +01:00 by adam · 1 comment
Owner

Originally created by @kallekoo on GitHub (May 17, 2024).

Hello!

Using pkl-go v0.6.0, when creating an evaluator like so

var opts = func(o *pkl.EvaluatorOptions) {
	o.AllowedModules = []string{".+"}
	o.AllowedResources = []string{".+"}
	o.CacheDir = ""
}
e, err := pkl.NewEvaluator(ctx, opts)

and evaluating a FileSource like so

s, err := e.EvaluateOutputText(ctx, pkl.FileSource(p))

where the underlying data for the path p changes between evaluations, the evaluator output remains unchanged.

The workaround is to recreate the evaluator at appropriate intervals, but that leads to an overhead when the evaluator is being set up.

Originally created by @kallekoo on GitHub (May 17, 2024). Hello! Using pkl-go v0.6.0, when creating an evaluator like so ```go var opts = func(o *pkl.EvaluatorOptions) { o.AllowedModules = []string{".+"} o.AllowedResources = []string{".+"} o.CacheDir = "" } e, err := pkl.NewEvaluator(ctx, opts) ``` and evaluating a FileSource like so ``` s, err := e.EvaluateOutputText(ctx, pkl.FileSource(p)) ``` where the underlying data for the path `p` changes between evaluations, the evaluator output remains unchanged. The workaround is to recreate the evaluator at appropriate intervals, but that leads to an overhead when the evaluator is being set up.
adam closed this issue 2025-12-30 01:21:40 +01:00
Author
Owner

@holzensp commented on GitHub (May 17, 2024):

This is expected behaviour. A single evaluator instance caches aggressively. This is how Pkl manages to be deterministic, which is a core design goal.

but that leads to an overhead when the evaluator is being set up

Not caching leads to overhead everywhere else.

@holzensp commented on GitHub (May 17, 2024): This is expected behaviour. A single evaluator instance caches aggressively. This is how Pkl manages to be deterministic, which is a core design goal. > but that leads to an overhead when the evaluator is being set up Not caching leads to overhead _everywhere else_.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#165