psf/cachecontrol

Cache performs two gets on misses

akursar opened this issue · 0 comments

We observe two cache.get() calls whenever we miss. The first attempt is made in CacheController.cached_request(). We see the "No cache entry available" in logs. However, we immediately see another cache.get() call after this. This seems to be because CacheController.conditional_headers() makes another call to self.cache.get().
This doesn't appear to be ideal, but I'm not sure what change to propose. I see some other usage of self.cache.get in the Controller as well. Since we don't rely on etag/last-modified headers, we may just use a custom Controller that has a condition_headers that simply returns {}, but raising here to see if there's any shared appreciation for trying to limit the number of get calls to make to the cache, or ideas for how otherwise to improve that.