Added lazy connections
Only connect just before we need an active connection
Minor cleanup, update syntax to PSR-2 standards
Also changed the Cache class to use the Json helper so exceptions are thrown within invalid JSON
Connect to the database before the tests
It doesn't happen automatically anymore unless a query is executed