Big rework with cache thread. Could not seem to get it to work well because gunicorn threads keep dying. Fixed by starting another daemon process that handles encodes before gunicorn starts.