Use always strings for cache keys (#13631)
* Use always strings for cache keys * fixing tests * Addressing PR review comments * Adding the base to FormatInt * Fix typo
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d881b68a38
Коммит
06fb1458ca
@@ -9,6 +9,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -434,7 +435,7 @@ func resolveMetadataURL(requestURL string, siteURL string) string {
|
||||
}
|
||||
|
||||
func getLinkMetadataFromCache(requestURL string, timestamp int64) (*opengraph.OpenGraph, *model.PostImage, bool) {
|
||||
cached, ok := linkCache.Get(model.GenerateLinkMetadataHash(requestURL, timestamp))
|
||||
cached, ok := linkCache.Get(strconv.FormatInt(model.GenerateLinkMetadataHash(requestURL, timestamp), 16))
|
||||
if !ok {
|
||||
return nil, nil, false
|
||||
}
|
||||
@@ -497,7 +498,7 @@ func cacheLinkMetadata(requestURL string, timestamp int64, og *opengraph.OpenGra
|
||||
val = image
|
||||
}
|
||||
|
||||
linkCache.AddWithExpiresInSecs(model.GenerateLinkMetadataHash(requestURL, timestamp), val, LINK_CACHE_DURATION)
|
||||
linkCache.AddWithExpiresInSecs(strconv.FormatInt(model.GenerateLinkMetadataHash(requestURL, timestamp), 16), val, LINK_CACHE_DURATION)
|
||||
}
|
||||
|
||||
func (a *App) parseLinkMetadata(requestURL string, body io.Reader, contentType string) (*opengraph.OpenGraph, *model.PostImage, error) {
|
||||
|
||||
Ссылка в новой задаче
Block a user