Documentation
¶
Overview ¶
Package cache provides TTL-based caching for API metadata.
Index ¶
Constants ¶
View Source
const ( // DefaultTTLHours is the default cache TTL if not configured DefaultTTLHours = 24 // DrivesFile is the cache file for shared drives DrivesFile = "drives.json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides TTL-based caching for API metadata
func New ¶
New creates a new Cache instance rooted at the OS cache dir (B2b). It also runs a transparent, best-effort one-time relocation of a pre-B2b cache that lived inside the config dir; relocation never fails New (the cache is disposable — it simply repopulates).
func (*Cache) GetDrives ¶
func (c *Cache) GetDrives() ([]*CachedDrive, error)
GetDrives returns cached shared drives, or nil if cache is stale or missing
func (*Cache) SetDrives ¶
func (c *Cache) SetDrives(drives []*CachedDrive) error
SetDrives updates the cached shared drives
type CachedDrive ¶
CachedDrive represents a cached shared drive entry
type DriveCache ¶
type DriveCache struct {
CachedAt time.Time `json:"cached_at"`
TTLHours int `json:"ttl_hours"`
Drives []*CachedDrive `json:"drives"`
}
DriveCache represents the cached shared drives data
Click to show internal directories.
Click to hide internal directories.