aboutsummaryrefslogtreecommitdiff
path: root/internal/thumbnail/cache.go
diff options
context:
space:
mode:
authorRanXom <saiyedshizain@gmail.com>2026-07-13 14:11:53 +0530
committerRanXom <saiyedshizain@gmail.com>2026-07-13 14:11:53 +0530
commite48a9f9dafefef4844c49d417af8d13978455247 (patch)
tree4c1777ca27d38264bae5e6f01d96d63e494f3794 /internal/thumbnail/cache.go
parent546751bda402887fe31f09768e29d1cf5f531f83 (diff)
downloadgalleryd-e48a9f9dafefef4844c49d417af8d13978455247.tar.xz
galleryd-e48a9f9dafefef4844c49d417af8d13978455247.zip
feat(thumbnail): initialize thumbnail cache
Diffstat (limited to 'internal/thumbnail/cache.go')
-rw-r--r--internal/thumbnail/cache.go11
1 files changed, 8 insertions, 3 deletions
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,
)