Initializing a Cache instance with a None app and setting it later
via init_app causes the app attribute never to be set. This is fine for
most cases, since the cache is being set to the app extension. However,
it causes crashes when calling the Cache outside of a Flask context
(e.g.: spawned threads).
I found this while updating a project I was working on from an old Flask-Cache version to the most up-to-date. Our app was crashing when it spawned gevent threads in order to load data in parallel.
Initializing a Cache instance with a None app and setting it later via init_app causes the app attribute never to be set. This is fine for most cases, since the cache is being set to the app extension. However, it causes crashes when calling the Cache outside of a Flask context (e.g.: spawned threads).
I found this while updating a project I was working on from an old Flask-Cache version to the most up-to-date. Our app was crashing when it spawned gevent threads in order to load data in parallel.