Documentation
¶
Overview ¶
Package cache provides TTL caching for repeated filesystem discovery operations.
Index ¶
- func CleanupExpiredFileSystemEntries()
- func ClearFileSystemCache()
- func GetDirectoryRoot(key string, resolver func() (string, error)) (string, error)
- func GetFileExists(key string, checker func() bool) bool
- func GetModulePath(key string, resolver func() (string, error)) (string, error)
- type Entry
- type FileSystemCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupExpiredFileSystemEntries ¶
func CleanupExpiredFileSystemEntries()
CleanupExpiredFileSystemEntries cleans up expired file system entries.
func ClearFileSystemCache ¶
func ClearFileSystemCache()
ClearFileSystemCache clears file system cache.
func GetDirectoryRoot ¶
GetDirectoryRoot returns a cached directory root or resolves and caches it.
func GetFileExists ¶
GetFileExists returns a cached file existence check or runs and caches it.
Types ¶
type FileSystemCache ¶
type FileSystemCache struct {
// contains filtered or unexported fields
}
FileSystemCache is a small TTL cache for repeated filesystem lookups.
func NewFileSystemCache ¶
func NewFileSystemCache(ttl time.Duration) *FileSystemCache
NewFileSystemCache creates a new file system cache.
func (*FileSystemCache) CleanupExpired ¶
func (fsc *FileSystemCache) CleanupExpired()
CleanupExpired removes entries whose TTL has elapsed.
func (*FileSystemCache) Clear ¶
func (fsc *FileSystemCache) Clear()
Clear removes all cached entries.
func (*FileSystemCache) Delete ¶
func (fsc *FileSystemCache) Delete(key string)
Delete removes a value from the cache.
func (*FileSystemCache) Get ¶
func (fsc *FileSystemCache) Get(key string) (any, bool)
Get returns a cached value when it exists and has not expired.
func (*FileSystemCache) Set ¶
func (fsc *FileSystemCache) Set(key string, value any)
Set stores a value under key using the cache TTL.