summaryrefslogtreecommitdiff
path: root/cache.go
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-21 13:57:07 +0800
committerEltrac <hi@guhub.cn>2025-11-21 13:57:07 +0800
commitc9dd811d81be2433bf5b1de540da639c95a0c7f3 (patch)
tree3787e683ea31ed667196f4fc4fb81ab72423e27f /cache.go
parent5205a76de15203655f9807578c8b5586f98a82bc (diff)
feat: add cache related flags
- `--no-cache` for lookup without caching - `--clear-cache` to delete all cache files and not look up
Diffstat (limited to 'cache.go')
-rw-r--r--cache.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cache.go b/cache.go
index d0b11e5..a81ea66 100644
--- a/cache.go
+++ b/cache.go
@@ -35,3 +35,8 @@ func WriteCache(relPath string, data []byte) error {
path := CachePath(relPath)
return os.WriteFile(path, data, 0o644)
}
+
+func ClearCache() error {
+ path := CachePath("")
+ return os.RemoveAll(path)
+}