Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
FileCache is a file-based LRU cache. It tracks files in memory and evicts the least recently used when count or total size limits are exceeded.
func (*FileCache) Get ¶
Get reads data from the cache and promotes the entry to most recently used. Returns (nil, false) on cache miss or read error. Nil-safe: calling Get on a nil *FileCache always returns (nil, false).
func (*FileCache) Len ¶
Len returns the number of entries currently in the cache. Nil-safe: calling Len on a nil *FileCache returns 0.
type Options ¶
type Options struct {
// Dir is the directory where cache files are stored.
// Created if it does not exist.
Dir string
// MaxCount is the maximum number of files in the cache.
// When exceeded, the least recently used files are evicted.
MaxCount int
// MaxBytes is the maximum total size in bytes of all cached files.
// When exceeded, the least recently used files are evicted.
MaxBytes int64
}
Click to show internal directories.
Click to hide internal directories.