openclimatefix/pv-site-api

Add active caching

peterdudfield opened this issue · 0 comments

Detailed Description

Currently we use passive caching, a route is called and then the results are found and cached. If the results are already cached then we use the results.

Context

  • if two users call the route with no cache, then the route is called twice

Possible Implementation

  • Use active caching.
  • This could be done by every 1 mins, or when needed the cache is updated. For example the airflow could call the api. We could pass in a variable in the route called cache=False which forces the cache not to be used
  • Then the users always loads the cache
  • fail safe: if the cache is more than 1 hour old, then the cache is not used