Skip to content

Commit

Permalink
Check for possible cache eviction.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszraczylo committed Dec 3, 2021
1 parent 5cd2231 commit ea7ec68
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()})
}
Expand Down

0 comments on commit ea7ec68

Please sign in to comment.