func (evc *EventCache) Flush() {
	for _, ei := range evc.events {
		evc.evsw.FireEvent(ei.event, ei.data)
	}
	evc.events = make([]eventInfo, eventsBufferSize)
}
Fire events by running evsw.FireEvent on all cached events. Blocks.
Clears cached events
package events
const (
	eventsBufferSize = 1000
)
type EventCache struct {
	evsw   Fireable
	events []eventInfo
}
func NewEventCache(evsw Fireable) *EventCache {
	return &EventCache{
		evsw:   evsw,
		events: make([]eventInfo, eventsBufferSize),
	}
}
type eventInfo struct {
	event string
	data  EventData
}
func (evc *EventCache) FireEvent(event string, data EventData) {
	evc.events = append(evc.events, eventInfo{event, data})
}