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.