1
0

Refactor & fix storing struct-values in redis keyvalue

This commit is contained in:
kolaente
2021-05-28 10:52:32 +02:00
parent df45675df3
commit d48aa101cf
10 changed files with 117 additions and 59 deletions

View File

@ -122,7 +122,8 @@ func getImageID(fullURL string) string {
// Gets an unsplash photo either from cache or directly from the unsplash api
func getUnsplashPhotoInfoByID(photoID string) (photo *Photo, err error) {
p, exists, err := keyvalue.Get(cachePrefix + photoID)
photo = &Photo{}
exists, err := keyvalue.GetWithValue(cachePrefix+photoID, photo)
if err != nil {
return nil, err
}
@ -134,8 +135,6 @@ func getUnsplashPhotoInfoByID(photoID string) (photo *Photo, err error) {
if err != nil {
return
}
} else {
photo = p.(*Photo)
}
return
}