utils.cache.learn_cache_key()

learn_cache_key(request, response, cache_timeout=None, key_prefix=None) [source]

Learns what headers to take into account for some request path from the response object. It stores those headers in a global path registry so that later access to that path will know what headers to take into account without building the response object itself. The headers are named in the Vary header of the response, but we want to prevent response generation.

The list of headers to use for cache key generation is stored in the same cache as the pages themselves. If the cache ages some data out of the cache, this just means that we have to build the response once to get at the Vary header and so at the list of headers to use for the cache key.

doc_Django
2016-10-09 18:40:20
Comments
Leave a Comment

Please login to continue.