From d8d83484af755f81f20fa6212e1dbfd56d4545ba Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 2 Jun 2020 17:26:24 +0300 Subject: [PATCH] set cached methods --- pkg/zabbix.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/zabbix.go b/pkg/zabbix.go index 4851d84..d23543f 100644 --- a/pkg/zabbix.go +++ b/pkg/zabbix.go @@ -14,12 +14,14 @@ import ( "golang.org/x/net/context" ) -var NotCachedMethods = map[string]bool{ - "history.get": true, - "trend.get": true, - "problem.get": true, - "trigger.get": true, - "apiinfo.version": true, +var CachedMethods = map[string]bool{ + "hostgroup.get": true, + "host.get": true, + "application.get": true, + "item.get": true, + "service.get": true, + "usermacro.get": true, + "proxy.get": true, } // ZabbixQuery handles query requests to Zabbix @@ -35,7 +37,7 @@ func (ds *ZabbixDatasourceInstance) ZabbixQuery(ctx context.Context, apiReq *Zab 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.queryCache.Set(requestHash, resultJson) }