move cache to the separate package

This commit is contained in:
Alexander Zobnin
2020-06-03 10:24:32 +03:00
parent d8d83484af
commit 1e04c310df
6 changed files with 13 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ import (
"regexp"
"time"
"github.com/alexanderzobnin/grafana-zabbix/pkg/cache"
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbix"
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbixapi"
simplejson "github.com/bitly/go-simplejson"
@@ -28,7 +29,7 @@ var CachedMethods = map[string]bool{
func (ds *ZabbixDatasourceInstance) ZabbixQuery(ctx context.Context, apiReq *ZabbixAPIRequest) (*simplejson.Json, error) {
var resultJson *simplejson.Json
var err error
requestHash := HashString(apiReq.String())
requestHash := cache.HashString(apiReq.String())
cachedResult, queryExistInCache := ds.queryCache.Get(requestHash)
if !queryExistInCache {