rOpenGov / geofi

R package for accessing Finnish geospatial data
https://ropengov.github.io/geofi/
Other
19 stars 6 forks source link

Implement cache for wfs_api() #1

Closed jlehtoma closed 4 years ago

jlehtoma commented 5 years ago

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.

jlehtoma commented 5 years ago

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.

antagomir commented 5 years ago

Sounds good to me.

jlehtoma commented 4 years ago

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