set cached methods
This commit is contained in:
@@ -14,12 +14,14 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
var NotCachedMethods = map[string]bool{
|
var CachedMethods = map[string]bool{
|
||||||
"history.get": true,
|
"hostgroup.get": true,
|
||||||
"trend.get": true,
|
"host.get": true,
|
||||||
"problem.get": true,
|
"application.get": true,
|
||||||
"trigger.get": true,
|
"item.get": true,
|
||||||
"apiinfo.version": true,
|
"service.get": true,
|
||||||
|
"usermacro.get": true,
|
||||||
|
"proxy.get": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZabbixQuery handles query requests to Zabbix
|
// ZabbixQuery handles query requests to Zabbix
|
||||||
@@ -35,7 +37,7 @@ func (ds *ZabbixDatasourceInstance) ZabbixQuery(ctx context.Context, apiReq *Zab
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := NotCachedMethods[apiReq.Method]; !ok {
|
if _, ok := CachedMethods[apiReq.Method]; ok {
|
||||||
ds.logger.Debug("Write result to cache", "method", apiReq.Method)
|
ds.logger.Debug("Write result to cache", "method", apiReq.Method)
|
||||||
ds.queryCache.Set(requestHash, resultJson)
|
ds.queryCache.Set(requestHash, resultJson)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user