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:
parent
715deaebb8
commit
c1cc320030
1 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue