Expand description
Filesystem-watching loader (issue #52). Gated behind the watch
feature: watch::WatchLoader wraps any loader, caches its
templates, and invalidates them on debounced change events.
§Watching loader (issue #52)
WatchLoader wraps any
TemplateLoader, caches what it loads,
and drops the cache when files under a watched directory change.
Change events from the operating system (via notify) are
debounced: a burst of events (an editor’s save writes a temporary
file, renames it, touches metadata) becomes one batch once no new
event has arrived for the debounce window, 200 ms by default.
Each batch also goes to every WatchLoader::subscribe receiver,
so a host can clear its own caches (for example
Engine::clear_cache, whose rendered
pages embed partials) and re-render.
Gated behind the watch feature.
Structs§
- Watch
Loader - A
TemplateLoaderthat caches another loader’s templates and invalidates the cache when files under a watched directory change.
Constants§
- DEFAULT_
DEBOUNCE - The default debounce window: a batch is delivered once no change event has arrived for this long.