fix cached annotations not displaying

This commit is contained in:
rramiachraf
2024-03-04 20:43:46 +01:00
parent 903d4ca99b
commit 679f34678c
4 changed files with 20 additions and 20 deletions

View File

@ -8,6 +8,10 @@ import (
"github.com/rramiachraf/dumb/data"
)
type cachable interface {
data.Album | data.Song | data.Annotation
}
var c, _ = bigcache.NewBigCache(bigcache.DefaultConfig(time.Hour * 24))
func setCache(key string, entry interface{}) error {
@ -19,7 +23,7 @@ func setCache(key string, entry interface{}) error {
return c.Set(key, data)
}
func getCache[v data.Album | data.Song | data.Annotation](key string) (v, error) {
func getCache[v cachable](key string) (v, error) {
var decoded v
data, err := c.Get(key)