aboutsummaryrefslogtreecommitdiff
path: root/internal/thumbnail/cache.go
diff options
context:
space:
mode:
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,
)