rOpenGov/geofi

Implement cache for wfs_api()

Closed this issue · 3 comments

Rudimentary implementation for getting data over WFS already exists in function wfs(). This function also needs a cache, I suggest using the R.cache package. Cached entities are the GML objects returned from the WFS. Decision need to be done regarding cache policies such as expiration time, flushing mechanism etc.

I'm not too familiar with caching best practices, but here's what I had in mind:

  1. Caching is opt-in, i.e the default is get_wfs_layer([...], cache = FALSE)
  2. Cache does not expire, i.e. it's up to the user to refresh the cache if needed.
  3. User will always be notified (message()) of all caching operations (i.e. saving and loading).

2 and 3 are pretty straightforward, but I'm more ambivalent about 1. It could equally well be argued, that caching should be enabled by default.

Sounds good to me.

New implementation of wfs_api() is using httpcache, which implements a rudimentary cachde.