Ticket #9334: ticket-9334.diff

File ticket-9334.diff, 2.2 KB (added by Horst Gutmann <zerok@…>, 13 years ago)
  • docs/topics/cache.txt

    diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt
    index 839e03d..d084feb 100644
    a b time, rather than :setting:`CACHE_MIDDLEWARE_SECONDS`. Using the decorators in  
    477477the ``never_cache`` decorator). See the `using other headers`__ section for
    478478more on these decorators.
    479479
     480.. _middleware_cache_key:
     481
     482The key used by the middleware to store and retrieve pages is based on the
     483request path  as well as all the header values provided by ``request.META``.
     484The actual key format looks like this::
     485
     486    views.decorators.cache.cache_page.<key-prefix>.<http-method>.<MD5(path)>.<MD5(headers)>
     487
     488.. note::
     489
     490    The format of the cache key and its generation is part of Django's private
     491    API and is therefor not guaranteed to be stable between releases.
     492
    480493.. _i18n-cache-key:
    481494
    482495.. versionadded:: 1.2
    The two settings can also be combined. If you specify a ``cache`` *and*  
    547560a ``key_prefix``, you will get all the settings of the requested cache
    548561alias, but with the key_prefix overridden.
    549562
     563The key used by this function is generated using the same logic as the one
     564used by the :ref:`CacheMiddleware <middleware_cache_key>`.
     565
    550566Specifying per-view cache in the URLconf
    551567----------------------------------------
    552568
    template tag to uniquely identify the cache fragment:  
    611627It's perfectly fine to specify more than one argument to identify the fragment.
    612628Simply pass as many arguments to ``{% cache %}`` as you need.
    613629
     630The key generated based on the fragment name and the additional arguments has
     631following format::
     632
     633    template.cache.<fragment-name>.<MD5(arguments)>
     634
     635The arguments are resolved within the current context, URL-quoted and joined
     636with a colon. The resulting string is then MD5-hashed and appended to the
     637key. So, for instance, in the example above if the current user's
     638username were "username", the generated cache key would look like this::
     639
     640    template.cache.sidebar.14c4b06b824ec593239362517f538b29
     641
    614642If :setting:`USE_I18N` is set to ``True`` the per-site middleware cache will
    615643:ref:`respect the active language<i18n-cache-key>`. For the ``cache`` template
    616644tag you could use one of the
Back to Top