Documentation
¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedFS ¶
type CachedFS struct {
// contains filtered or unexported fields
}
CachedFS provides a cached view of a filesystem directory that implements fs.FS. It pre-caches all files at startup and serves them from memory, rechecking files periodically and refreshing stale entries in the background without blocking reads.
func New ¶
New creates a new CachedFS rooted at the given directory. It pre-caches all files, starts background recheck, and sets up SIGHUP handling.
func (*CachedFS) ForceRecheck ¶
func (c *CachedFS) ForceRecheck()
ForceRecheck triggers an immediate recheck of all cached files.
type FSNotifyWatcher ¶
type FSNotifyWatcher struct {
// contains filtered or unexported fields
}
FSNotifyWatcher wraps fsnotify to provide filesystem change notifications.
func (*FSNotifyWatcher) Close ¶
func (w *FSNotifyWatcher) Close() error
type Option ¶
type Option func(*CachedFS)
Option configures a CachedFS instance.
func WithCacheTTL ¶
WithCacheTTL sets how long before a cached entry is considered stale. Default is 5 minutes.
func WithFSNotify ¶
func WithFSNotify() Option
WithFSNotify enables filesystem notifications via fsnotify. This will trigger rechecks when files change, in addition to the periodic recheck.
func WithInotifyDebounce ¶
WithInotifyDebounce sets the delay before processing inotify events. Default is 5 seconds.
func WithRecheckInterval ¶
WithRecheckInterval sets how often the background recheck runs. Default is 5 minutes.
func WithoutSIGHUP ¶
func WithoutSIGHUP() Option
WithoutSIGHUP disables the SIGHUP handler. By default, SIGHUP triggers a full recheck of all cached files.