From e48a9f9dafefef4844c49d417af8d13978455247 Mon Sep 17 00:00:00 2001 From: RanXom Date: Mon, 13 Jul 2026 14:11:53 +0530 Subject: feat(thumbnail): initialize thumbnail cache --- internal/thumbnail/cache.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'internal/thumbnail/cache.go') diff --git a/internal/thumbnail/cache.go b/internal/thumbnail/cache.go index 80164e9..740268a 100644 --- a/internal/thumbnail/cache.go +++ b/internal/thumbnail/cache.go @@ -1,16 +1,21 @@ package thumbnail import ( + "fmt" "path/filepath" "github.com/RanXom/galleryd/internal/gallery" ) const ( - thumbnailVersion = "v1" - thumbnailExtension = ".webp" + thumbnailCacheVersion = 1 + thumbnailExtension = ".webp" ) +func cacheVersion() string { + return fmt.Sprintf("v%d", thumbnailCacheVersion) +} + // cachePath returns the on-disk cache location for a photo thumbnail. // // Thumbnails are sharded by the first two characters of the photo ID to @@ -23,7 +28,7 @@ func (g *Generator) cachePath(photo gallery.Photo) string { return filepath.Join( g.cacheDir, "thumbs", - thumbnailVersion, + cacheVersion(), shard, filename, ) -- cgit v1.2.3