Closed asenci closed 6 years ago
Can be used with marshal/unmarshal to implement template caching
Example code:
s := ipfix.NewSession() fmt.Println("Loading template cache") trecsJson, _ := ioutil.ReadFile("templates.json") trecs := make([]ipfix.TemplateRecord, 0) json.Unmarshal(trecsJson, &trecs) s.LoadTemplateRecords(trecs) go func() { tik := time.Tick(10 * time.Second) for range tik { fmt.Println("Exporting template cache") trecs := s.ExportTemplateRecords() trecsJson, _ := json.Marshal(trecs) ioutil.WriteFile("templates.json", trecsJson, 0644) } }()
LGTM. Please gofmt it.
Sorry for that, still getting used to the Go toolchain... 😄 Fmted, veted and tested.
No worries. :)
Can be used with marshal/unmarshal to implement template caching
Example code: