Check for possible cache eviction.

This commit is contained in:
2021-12-03 15:12:02 +00:00
parent 5cd22318f1
commit ea7ec683ef
+4 -2
View File
@@ -52,9 +52,11 @@ func (g *GraphQL) Query(queryContent string, queryVariables interface{}, queryHe
if g.Cache {
g.Log.Debug("Checking the cache for the query", map[string]interface{}{"_query": queryHash})
if entry, err := g.CacheStore.Get(queryHash); err == nil {
if entry, entryInfo, err := g.CacheStore.GetWithInfo(queryHash); err == nil {
g.Log.Debug("Found the query in the cache", map[string]interface{}{"_query": queryHash})
return string(entry), nil
if pandati.IsZero(entryInfo.EntryStatus) {
return string(entry), nil
}
} else {
g.Log.Debug("Unable to find the query in the cache", map[string]interface{}{"_query": queryHash, "_error": err.Error()})
}