package http import ( "github.com/labstack/echo/v4" "github.com/siteworxpro/top-wallpaper/redis" "net/http" ) func Get(c echo.Context) error { rc, err := redis.NewRedis() if err != nil { return c.String(http.StatusInternalServerError, "Internal Server Error: "+err.Error()) } val, err := rc.Get(redis.CacheKey) if err != nil || val == "" { return c.NoContent(http.StatusNoContent) } c.Response().Header().Set("Cache-Control", "public, max-age=600") return c.Blob(http.StatusOK, "image/jpeg", []byte(val)) }