Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
ac90aee5
Kaydet (Commit)
ac90aee5
authored
May 30, 2013
tarafından
Ramiro Morales
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Tweak caching decorators/utility functions xrefs.
üst
9d06c6cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
request-response.txt
docs/ref/request-response.txt
+2
-2
cache.txt
docs/topics/cache.txt
+9
-7
No files found.
docs/ref/request-response.txt
Dosyayı görüntüle @
ac90aee5
...
...
@@ -591,8 +591,8 @@ Note that unlike a dictionary, ``del`` doesn't raise ``KeyError`` if the header
field doesn't exist.
For setting the ``Cache-Control`` and ``Vary`` header fields, it is recommended
to use the :
meth
:`~django.utils.cache.patch_cache_control` and
:
meth
:`~django.utils.cache.patch_vary_headers` methods from
to use the :
func
:`~django.utils.cache.patch_cache_control` and
:
func
:`~django.utils.cache.patch_vary_headers` methods from
:mod:`django.utils.cache`, since these fields can have multiple, comma-separated
values. The "patch" methods ensure that other values, e.g. added by a
middleware, are not removed.
...
...
docs/topics/cache.txt
Dosyayı görüntüle @
ac90aee5
...
...
@@ -997,8 +997,8 @@ produces different content based on some difference in request headers -- such
as a cookie, or a language, or a user-agent -- you'll need to use the ``Vary``
header to tell caching mechanisms that the page output depends on those things.
To do this in Django, use the convenient
``vary_on_headers`` view decorator,
like so::
To do this in Django, use the convenient
:func:`django.views.decorators.vary.vary_on_headers` view decorator,
like so::
from django.views.decorators.vary import vary_on_headers
...
...
@@ -1027,8 +1027,9 @@ the user-agent ``Mozilla`` and the cookie value ``foo=bar`` will be considered
different from a request with the user-agent ``Mozilla`` and the cookie value
``foo=ham``.
Because varying on cookie is so common, there's a ``vary_on_cookie``
decorator. These two views are equivalent::
Because varying on cookie is so common, there's a
:func:`django.views.decorators.vary.vary_on_cookie` decorator. These two views
are equivalent::
@vary_on_cookie
def my_view(request):
...
...
@@ -1041,7 +1042,7 @@ decorator. These two views are equivalent::
The headers you pass to ``vary_on_headers`` are not case sensitive;
``"User-Agent"`` is the same thing as ``"user-agent"``.
You can also use a helper function,
``django.utils.cache.patch_vary_headers`
`,
You can also use a helper function,
:func:`django.utils.cache.patch_vary_headers
`,
directly. This function sets, or adds to, the ``Vary header``. For example::
from django.utils.cache import patch_vary_headers
...
...
@@ -1090,8 +1091,9 @@ exclusive. The decorator ensures that the "public" directive is removed if
"private" should be set (and vice versa). An example use of the two directives
would be a blog site that offers both private and public entries. Public
entries may be cached on any shared cache. The following code uses
``patch_cache_control``, the manual way to modify the cache control header
(it is internally called by the ``cache_control`` decorator)::
:func:`django.utils.cache.patch_cache_control`, the manual way to modify the
cache control header (it is internally called by the ``cache_control``
decorator)::
from django.views.decorators.cache import patch_cache_control
from django.views.decorators.vary import vary_on_cookie
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment