I have a QGIS project that makes heavy use of WFS for source layers. I tend to prefer this because I like to ensure that my map will stay current with changes to authoritive data sources (e.g. roads, administrative boundaries). My current region of interest is very small (a single town and small hinterland), but the WFS coming from a national government source is very large (many MBs of features that I'll never look at). QGIS seems good at limiting my requests, but on loading my project I find that it has to spend several minutes making WFS requests and re-downloading data that I'm positive is not going to change in the period that I'm working on my project.
I find this time waiting on these large WFS queries to complete is frustrating. Occasionally waiting on the response actually causes QGIS to crash, and I have to re-open QGIS and then it will start the downloads again from scratch.
Is there a way to set explicit client-side caching for WFS layers in the client (QGIS) to prevent a re-download? If I could tell QGIS to only perform a new query after a month (or whenever I deliberately clear or invalidate the cache), that would be ideal. I want this to work across sessions.
Existing similar questions and why they're not relevant:
- WFS Feature Caching in QGIS | Actually about a cache feature limit problem in the same QGIS session rather than caching WFS in QGIS across sessions.
- WFS Caching / Back button | Caching in the browser.
I'm using QGIS 2.99 (master), which I gather is more or less QGIS 2.18.
Something I just observed: I found the reloading process this morning to be much faster than last night when I wrote a draft of this question, so it could be that I'm mistaken and that there already exists some kind of client-side cache or perhaps a mechanism for producing a diff and making a targeted query. However there was still one layer (landuse: with many thousands of complex features) that appeared to completely re-download. Is this then perhaps a matter of missing server-side cache headers for this particular service? This layer is from a different source than the rest of my layers. But is there still a way to declare a cache expiry in QGIS as the client, even if the server doesn't adequately set cache headers?
Indeed this question (Cached Featured in WFS - can I change default) suggests that QGIS does indeed default to caching WFS responses. (But the question asks whether there is a setting to override the use of a cache, which is related... and unanswered).
These questions (Is the QGIS cache directory automatically created? and How do I use a filter on an uncached WFS layer in QGIS?) tell me that QGIS definitely does caching. I'm only surprised because I keep seeing (some) of my own layers re-download after I restart.