I am working on a django application. The main task of the application is providing suggestion like "Should I go outside today?". There is only a single endpoint to get the suggestion such as example.com/.
The main logic for providing the suggestion is:
Does the user has any pending task today? (querying from UserTaskModel)
Is today's weather is comfortable? (calculating weather forecasting)
If two user try to fetch data at the same date then the UserTask query will be different. But weather forecast query task will be same. If I use view based django caching then the weather forecast query will be execute for each user. But I want to cache the weather query data for all user at a same date. It can view implement by creating different view for the weather. But I don't want to use another endpoint for the weather.
Django cache set-get method can be use for this task. But is this way is the best way to do this type of task? In my example I use a simple weather calculation query depending the the date. But is this technique is good for complex query?