Trip caching

20 views
Skip to first unread message

Tim

unread,
Sep 20, 2017, 5:03:50 PM9/20/17
to OneBusAway API
What's the recommended interval to locally cache trip data? A day seems safe, but almost not worth the hassle of caching. A week seems adequate, but there's no way of knowing when the data will become stale without looking at the underlying GTFS.

sjbarbeau

unread,
Sep 20, 2017, 11:25:45 PM9/20/17
to OneBusAway API
Hey Tim,
I assume you're talking about caching schedule (GTFS) data available via the OBA APIs.

The short answer is I don't know - to my knowledge all the official OBA apps operate completely online without any caching due to the information changing.  As you say, there is no way to know when the underlying data is updated, especially when there are multiple agencies in a region.

The best I can suggest is to implement a hashing mechanism so you can retrieve the trip data and check if it's changed since the last update, so you don't have to go through updating your local cache again if it hasn't changed.  Of course, this means you'd still need to hit the API again...

Sean

Sheldon A. Brown

unread,
Sep 21, 2017, 6:37:35 AM9/21/17
to onebusa...@googlegroups.com
Cache away. As long as you like. But as Sean suggest, check to see
if the bundle has changed -- I would suggest you check hourly.

This API exposes the current bundle name. If it changes, you'll need
to invalidate your cache:

https://github.com/camsys/onebusaway-application-modules/blob/unified/onebusaway-api-webapp/src/main/java/org/onebusaway/api/actions/api/where/ConfigAction.java


This hasn't been merged into master yet sadly. But soon...

Sheldon
> --
> You received this message because you are subscribed to the Google Groups
> "OneBusAway API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to onebusaway-ap...@googlegroups.com.
> To post to this group, send email to onebusa...@googlegroups.com.
> Visit this group at https://groups.google.com/group/onebusaway-api.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages