More tests for disk cache

This commit is contained in:
Kovid Goyal 2025-09-30 11:16:49 +05:30
parent ec6910074f
commit ca0ff68d8e
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 61 additions and 24 deletions

View file

@ -43,7 +43,9 @@ func NewDiskCache(path string, max_size int64) (dc *DiskCache, err error) {
if err = os.MkdirAll(path, 0o700); err != nil {
return
}
return &DiskCache{Path: path, MaxSize: max_size}, nil
dc = &DiskCache{Path: path, MaxSize: max_size}
err = dc.prune()
return
}
func KeyForPath(path string) (key string, err error) {