Moved some behaviour to one place

Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
Merge pull request #7319 from jvanbaarsen/small-eventcache-refactoring

Moved some behaviour to one place