feat: browser cache directives

This commit is contained in:
Ramires Viana committed 2021-04-19 12:49:40 +00:00
1 parent 603203848a
commit 190cb99a79
10 files changed
+41 -11

No files matched your search

+5
View File
@@ -79,6 +79,11 @@ func handleImagePreview(w http.ResponseWriter, r *http.Request, imgSvc ImgServic
return errToStatus(err), err
}
isFresh := checkEtag(w, r, file.ModTime.Unix(), file.Size)
if isFresh {
return http.StatusNotModified, nil
}
cacheKey := previewCacheKey(file.Path, file.ModTime.Unix(), previewSize)
cachedFile, ok, err := fileCache.Load(r.Context(), cacheKey)
if err != nil {