Documentation
¶
Overview ¶
Package cache provides domain logic for cache management operations including clearing directories, gathering cache information, and formatting byte sizes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ValidKinds lists all valid cache kinds.
Functions ¶
func ClearDirectory ¶
ClearDirectory removes files from a directory, optionally matching a pattern. Returns the number of files removed and total bytes reclaimed.
func FormatBytes ¶
FormatBytes formats bytes as a human-readable string.
Types ¶
type ClearOutput ¶
type ClearOutput struct {
RemovedFiles int64 `json:"removedFiles" yaml:"removedFiles"`
RemovedBytes int64 `json:"removedBytes" yaml:"removedBytes"`
RemovedHuman string `json:"reclaimedHuman" yaml:"reclaimedHuman"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
}
ClearOutput represents the result of a cache clear operation.
type Info ¶
type Info struct {
Name string `json:"name" yaml:"name"`
Path string `json:"path" yaml:"path"`
Size int64 `json:"size" yaml:"size"`
SizeHuman string `json:"sizeHuman" yaml:"sizeHuman"`
FileCount int64 `json:"fileCount" yaml:"fileCount"`
Description string `json:"description" yaml:"description"`
}
Info represents information about a cache directory.
func GetCacheInfo ¶
GetCacheInfo returns information about a cache directory.
type InfoOutput ¶
type InfoOutput struct {
Caches []Info `json:"caches" yaml:"caches"`
TotalSize int64 `json:"totalSize" yaml:"totalSize"`
TotalHuman string `json:"totalHuman" yaml:"totalHuman"`
TotalFiles int64 `json:"totalFiles" yaml:"totalFiles"`
}
InfoOutput represents aggregated information for multiple cache directories.
Click to show internal directories.
Click to hide internal directories.