redis.go 776 字节
Newer Older
E
eoLinker API Management 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
package monitor_key

import (
	"bytes"
)

func StrategyMapKey(cluster,now string)string  {
	key:= splicing("monitor-strategy:",cluster,":",now)
	//fmt.Println("StrategyMapKey:",key)
	return key
}
func APiMapKey(cluster,strategyId ,now string) string {
	key:= splicing("monitor-api:",cluster,":",strategyId,":",now)
	//fmt.Println("APiMapKey:",key)
	return key
}
func ApiValueKey(cluster,strategyId string,apiId string,now string)string  {
	key :=  splicing("monitor-value:",cluster,":",strategyId,":",apiId,":",now)
	//fmt.Println("ApiValueKey:",key)
	return key
}

func splicing(args ...string)string  {

	l:= 0
	for _,arg:= range args{

		 l+= len(arg)
	}
	buf:=make([]byte,0,l)
	b:=bytes.NewBuffer(buf)

	for _,arg:= range args{
		b.WriteString(arg)
	}
	return b.String()
}