kadamwhite / mbtawesome

An MBTA subway status application with a good attitude
http://www.mbtawesome.com
MIT License
11 stars 0 forks source link

Prime cache for a line when rendering that route #13

Closed kadamwhite closed 9 years ago

kadamwhite commented 9 years ago

Since the API calls are stored in an LRU cache, we can decrease the latency of front-end API calls by initializing the request when express renders the route. If the data is current no new request will be generated, and if the data is stale then by the time the front-end requests it the API call will already be in progress or completed.