Fire event before cache is cleared to allow tasks to be performed before hand

Signed-off-by: Ben James <in@benjam.es>
Cache\FileStore::flush does nothing if the cache root directory doesn't exists
Add cache events
Merge pull request #6659 from lucasmichot/5.0-cache-events

[5.0] Added Cache Events
Use contracts.
Ensure the forget cache events is fired after deletion
Merge branch '4.2'
Merge pull request #6615 from benjam-es/cache-pre-clear-event-patch

Fire event before cache is cleared to allow tasks to be performed before...
Merge branch '4.2'