coderedcorp/wagtail-cache

Should is_request_cacheable take the value of the last implementation result?

zerolab opened this issue · 2 comments

If you have 2 implementations of is_request_cacheable (A = False, B = True), the result of https://github.com/coderedcorp/wagtail-cache/blob/master/wagtailcache/cache.py#L35-L38 will be True.

As far as I see this, if anything says the request is not cacheable, then it should not be cacheable. e.g. the preview page.

Good point. The intention was to allow a full manual override. Maybe a better option would be to pass in the current caching decision (is_cacheable) to the hook, to allow the developer to decide how to handle.

The is_request_cacheable hook has been updated in master to pass in the previous results. If you are developing a hook, you will have full control to decide whether or not to cache.