1
0
Fork 0
mirror of https://github.com/alice-lg/birdwatcher.git synced 2025-03-09 00:00:05 +01:00

Improve caching of parsed birdc output.

This additionally caches the results after matching regular
expressions and improves performance further.

Credits: Hasan Pekdemir for the original idea.
This commit is contained in:
Patrick Seeburger 2018-07-05 15:03:58 +02:00 committed by Benedikt Rudolph
parent 715deaebb8
commit c1cc320030

View file

@ -177,7 +177,12 @@ func ProtocolsBgp() (Parsed, bool) {
for _, v := range protocols {
if strings.Contains(v, " BGP ") {
key := strings.Split(v, " ")[0]
bgpProto[key] = parseProtocol(v)
bgpProto[key], from_cache = fromCache(key)
if !from_cache {
parsed := parseProtocol(v)
bgpProto[key] = parsed
toCache(key, parsed)
}
}
}