mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-18 01:27:25 +00:00
Do not cache mutations.
This commit is contained in:
@@ -81,6 +81,12 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
|
|||||||
should_cache = c.cache.enabled
|
should_cache = c.cache.enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if queryContent does not start with `query` then we don't want to cache it
|
||||||
|
// because it's probably a mutation or subscription.
|
||||||
|
if !strutil.HasPrefix(queryContent, "query") {
|
||||||
|
should_cache = false
|
||||||
|
}
|
||||||
|
|
||||||
if should_cache {
|
if should_cache {
|
||||||
queryHash = strutil.Md5(fmt.Sprintf("%s-%+v", compiledQuery.compiledQuery, queryHeaders))
|
queryHash = strutil.Md5(fmt.Sprintf("%s-%+v", compiledQuery.compiledQuery, queryHeaders))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user