export cache package, add client interceptor customization
This commit is contained in:
22
core/stores/cache/util.go
vendored
Normal file
22
core/stores/cache/util.go
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
package cache
|
||||
|
||||
import "strings"
|
||||
|
||||
const keySeparator = ","
|
||||
|
||||
func TotalWeights(c []NodeConf) int {
|
||||
var weights int
|
||||
|
||||
for _, node := range c {
|
||||
if node.Weight < 0 {
|
||||
node.Weight = 0
|
||||
}
|
||||
weights += node.Weight
|
||||
}
|
||||
|
||||
return weights
|
||||
}
|
||||
|
||||
func formatKeys(keys []string) string {
|
||||
return strings.Join(keys, keySeparator)
|
||||
}
|
||||
Reference in New Issue
Block a user