Add on cache flush event

Adding a simple event dispatch upon cache flush (from the application), and hereby fixing  #1685
This should be a trivial merge.