| -rw-r--r-- | internal/router/api-v1-blog-search.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/internal/router/api-v1-blog-search.go b/internal/router/api-v1-blog-search.go index 946b830..41f2dec 100644 --- a/internal/router/api-v1-blog-search.go +++ b/internal/router/api-v1-blog-search.go @@ -36,9 +36,8 @@ func Api_V1_BlogSearch(l map[string]*locale.LocaleConfig, langs []string, b2Clie slog.Warn("unable to parse a client timezone, defaulting to UTC", slog.String("error", err.Error()), slog.String("tz", tz)) } - cacheKey := "blog-search." + lang + ".pages-list" var pages []*b2.BlogPage - if pagesBytes, ok := PCache.Get(cacheKey); pagesBytes != nil || ok { + if pagesBytes, ok := PCache.Get("blog-search.pages-list"); pagesBytes != nil || ok { json.Unmarshal(pagesBytes, &pages) } else { pages, err = b2Client.Scan(lang + "/") @@ -47,7 +46,7 @@ func Api_V1_BlogSearch(l map[string]*locale.LocaleConfig, langs []string, b2Clie return c.Status(fiber.ErrInternalServerError.Code).SendString(fmt.Sprintf("failed to scan pages for '%s' lang: %v", lang, err)) } pagesBytes, _ := json.Marshal(pages) - PCache.SetWithTTL(cacheKey, pagesBytes, int64(len(pagesBytes)), 5*time.Minute) + PCache.SetWithTTL("blog-search.pages-list", pagesBytes, int64(len(pagesBytes)), 5*time.Minute) } encodedQuery := c.Request().URI().QueryString() |