Switch to factory pattern, add Flask-Cache to the mix