FileWatchedValue
Pennington.Infrastructure
A lazily-loaded value that reloads on next access when a file in its Scope changes. Implements IFileWatchAware so FileWatchDispatcher drives the reload — this type holds no IFileWatcher subscription of its own.
Properties
ScopeFileWatchScope- The directory and pattern this value reloads for.
ValueT- The current value, loaded on first access and reloaded after a change in
Scope. WatchScopesIReadOnlyList<FileWatchScope>- Directories needing an OS-level watcher. Empty (the default) for aggregators that ride notifications other watchers already produce.
Constructors
FileWatchedValue
#public FileWatchedValue`1(FileWatchScope scope, Func<T> load)
Creates the holder; the value is not loaded until Value is first read.
Parameters
scopeFileWatchScope- The directory and pattern whose changes trigger a reload.
loadFunc<T>- Factory that produces the value.
Methods
OnFileChanged
#public FileWatchResponse OnFileChanged(FileChangeNotification change)
Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
Parameters
changeFileChangeNotification
Returns
FileWatchResponsePennington.Infrastructure.FileWatchedValue
namespace Pennington.Infrastructure;
/// A lazily-loaded value that reloads on next access when a file in its Scope changes. Implements IFileWatchAware so FileWatchDispatcher drives the reload — this type holds no IFileWatcher subscription of its own.
public class FileWatchedValue
{
/// Creates the holder; the value is not loaded until Value is first read.
public FileWatchedValue`1(FileWatchScope scope, Func<T> load)
;
/// Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
public FileWatchResponse OnFileChanged(FileChangeNotification change)
;
/// The directory and pattern this value reloads for.
public FileWatchScope Scope { get; }
/// The current value, loaded on first access and reloaded after a change in Scope.
public T Value { get; }
/// Directories needing an OS-level watcher. Empty (the default) for aggregators that ride notifications other watchers already produce.
public IReadOnlyList<FileWatchScope> WatchScopes { get; }
}