diff --git django/utils/cache.py django/utils/cache.py
index 9c566ae..389c5a1 100644
|
|
def _generate_cache_key(request, headerlist, key_prefix):
|
146 | 146 | return 'views.decorators.cache.cache_page.%s.%s.%s' % ( |
147 | 147 | key_prefix, iri_to_uri(request.path), ctx.hexdigest()) |
148 | 148 | |
| 149 | def _generate_cache_header_key(key_prefix, request): |
| 150 | """Returns a cache key for the header cache.""" |
| 151 | return 'views.decorators.cache.cache_header.%s.%s' % ( |
| 152 | key_prefix, iri_to_uri(request.path)) |
| 153 | |
149 | 154 | def get_cache_key(request, key_prefix=None): |
150 | 155 | """ |
151 | 156 | Returns a cache key based on the request path. It can be used in the |
… |
… |
def get_cache_key(request, key_prefix=None):
|
158 | 163 | """ |
159 | 164 | if key_prefix is None: |
160 | 165 | key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX |
161 | | cache_key = 'views.decorators.cache.cache_header.%s.%s' % ( |
162 | | key_prefix, iri_to_uri(request.path)) |
| 166 | cache_key = _generate_cache_header_key(key_prefix, request) |
163 | 167 | headerlist = cache.get(cache_key, None) |
164 | 168 | if headerlist is not None: |
165 | 169 | return _generate_cache_key(request, headerlist, key_prefix) |
… |
… |
def learn_cache_key(request, response, cache_timeout=None, key_prefix=None):
|
183 | 187 | key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX |
184 | 188 | if cache_timeout is None: |
185 | 189 | cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS |
186 | | cache_key = 'views.decorators.cache.cache_header.%s.%s' % ( |
187 | | key_prefix, iri_to_uri(request.path)) |
| 190 | cache_key = _generate_cache_header_key(key_prefix, request) |
188 | 191 | if response.has_header('Vary'): |
189 | 192 | headerlist = ['HTTP_'+header.upper().replace('-', '_') |
190 | 193 | for header in cc_delim_re.split(response['Vary'])] |