Add session starting logic to checkCacheCommands.

This fixes the case when cache is not flushed in live mode.
The session hasn't been started yet so there's nothing in there.
`$hasPermission` becomes false in that case.
Refactor session starting logic to be in one place
Merge pull request #13 from Focus-Flow/bug/cache-flushing-when-live

Add session starting logic to checkCacheCommands.