better perf: fail instead of overload and chache databases instances

Also fixes samples compile and test issues.

More details:
- app sends an internal server error instead of overloading application and database. this makes the user experience better
- we now cache the database instead of reading the configuration each time a DB request is evaluated
.gitignore
travis cl integration
Merge pull request #96 from freekh/perf-improvements

Perf improvements