Documentation
¶
Index ¶
- Constants
- func DefaultProviders() map[string]Provider
- func DirPath() (string, error)
- func EnsureDir() error
- func ExpandPaths(patterns []string) ([]string, error)
- func ExpandTilde(path string) (string, error)
- func ParseDuration(s string) (time.Duration, error)
- func Path() (string, error)
- func PathsExist(patterns []string) bool
- type Config
- type Loader
- func (l *Loader) Exists() (bool, error)
- func (l *Loader) InitDefault() (bool, error)
- func (l *Loader) Load() (*Config, error)
- func (l *Loader) LoadOrCreate() (*Config, bool, error)deprecated
- func (l *Loader) Save(cfg *Config) error
- func (l *Loader) SetConfigPath(path string)
- func (l *Loader) SkipDefaults()
- type Provider
Constants ¶
const DefaultMaxAge = 30 * 24 * time.Hour
DefaultMaxAge is the default maximum age for cache files (30 days).
Variables ¶
This section is empty.
Functions ¶
func DefaultProviders ¶
DefaultProviders returns builtin provider definitions.
func ExpandPaths ¶
ExpandPaths expands ~ and globs in path patterns.
func ExpandTilde ¶
ExpandTilde replaces ~ prefix with home directory.
func ParseDuration ¶
ParseDuration parses duration strings like "30d", "24h", "60m", "3600s". Supports: d (days), h (hours), m (minutes), s (seconds). If empty string, returns DefaultMaxAge.
func PathsExist ¶ added in v0.2.0
PathsExist checks if any of the given paths exist on disk.
Types ¶
type Config ¶
type Config struct {
Providers map[string]Provider `mapstructure:"providers" yaml:"providers"`
Version string `mapstructure:"version" yaml:"version"`
}
Config holds cache-buster configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns config with all default providers.
func (*Config) AllEnabledProviders ¶ added in v0.2.0
AllEnabledProviders returns all enabled providers regardless of path existence.
func (*Config) EnabledProviders ¶
EnabledProviders returns sorted list of enabled provider names with existing paths.
func (*Config) GetProvider ¶
GetProvider returns provider by name.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles config file operations.
func (*Loader) InitDefault ¶
InitDefault creates default config if missing. Returns true if created.
func (*Loader) LoadOrCreate
deprecated
func (*Loader) SetConfigPath ¶
SetConfigPath overrides config path (for testing).
func (*Loader) SkipDefaults ¶ added in v0.2.0
func (l *Loader) SkipDefaults()
SkipDefaults disables merging with defaults (for test isolation).
type Provider ¶
type Provider struct {
MaxSize string `mapstructure:"max_size" yaml:"max_size"`
MaxAge string `mapstructure:"max_age" yaml:"max_age,omitempty"`
CleanCmd string `mapstructure:"clean_cmd" yaml:"clean_cmd,omitempty"`
Paths []string `mapstructure:"paths" yaml:"paths"`
Enabled bool `mapstructure:"enabled" yaml:"enabled"`
}
Provider defines a cache provider's settings.