[ckan-dev] Caching

Florian.Brucker at mb.karlsruhe.de Florian.Brucker at mb.karlsruhe.de
Wed Mar 30 10:18:52 UTC 2016


I did some further research in the caching logic in `render` in
`lib/base.py`. It seems that in my case caching is always disabled due to
the `extra_vars` being passed via parameter. These extra variables contain
the data to be filled into the templates (e.g. the package information when
displaying a dataset), and hence a change in these variables would
invalidate a cached version of the template for the same URL (if we would
allow caching in that case). From my research this kind of content-based
cache invalidation (e.g. using an ETag-header) seems hard to do on the
Nginx-level and should rather be done in the application (i.e. CKAN)
itself. Although there seems to be some kind of page-caching built into
CKAN (cf. the `ckan.page_cache_enabled` configuration option) it seems to
respect the CKAN_PAGE_CACHABLE setting set by `lib.base.render`, which, as
discussed, won't allow caching of pages when extra variables are set.

So I guess my questions boils down to the following:

- Does CKAN support caching of rendered templates? If not, are there any
plans to add such a feature?

- What benefit do I have from using Nginx in front of Apache + CKAN if
Nginx will only cache static content?


Regards,
Florian


"ckan-dev" <ckan-dev-bounces at lists.okfn.org> schrieb am 29.03.2016
17:20:56:

> Von: Florian.Brucker at mb.karlsruhe.de
> An: ckan-dev at lists.okfn.org,
> Datum: 29.03.2016 17:21
> Betreff: [ckan-dev] Caching
> Gesendet von: "ckan-dev" <ckan-dev-bounces at lists.okfn.org>
>
> Hello everybody,
>
> I'm using Nginx as a caching proxy in front of Apache serving our
> CKAN instance, as described in the CKAN docs [0]. Most things work
> fine, however I've noticed that CKAN seems to add a "Cache-Control:
> private" HTTP-header to all responses except static files, even if
> the request does not come from a logged-in user. I do understand why
> one might want to bypass the cache for logged-in users (as it's done
> in the Nginx config example in the CKAN docs [1]), but why disable
> (public) caching for the generated HTML for not-logged-in requests?
> In my tests without a cache, page generation took much longer then
> downloading all the static content, so caching the generated HTML
> would make a lot of sense in my opinion.
>
>
> [0] http://docs.ckan.org/en/latest/maintaining/installing/deployment.html
> [1] http://docs.ckan.org/en/latest/maintaining/installing/
> deployment.html#create-the-nginx-config-file
>
>
> Regards,
> Florian_______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160330/88fd17f0/attachment-0003.html>


More information about the ckan-dev mailing list