frontend: cache the recent task queries
So as part of this commit, initialize the flask_cache mechanism, using
the already running redis database (we use it for session management).
The 'cache' object logically belongs to __init__.py, though it needs to
be placed on a pretty weird place (that's because there are
bi-directional dependencies among our modules, this is a problem but to
be solved in a different PR).
Also, instead of caching get_recent_tasks() directly, I created
get_recent_task_ids() which is safe for caching. That's because the
contents is just a list of integers, not sqlalchemy objects.
The problem of caching sqlalchemy objects is that they allow
lazy-loading later in templates, and if loaded from cache - when the
object isn't bound to any session - the lazy load attempt would fail.
Therefore we cache just the IDs, and before passing the objects down to
the template we perform another (but way cheaper) db query.