File: //usr/local/CyberPanel/lib/python3.10/site-packages/django/utils/__pycache__/cache.cpython-310.pyc
o
�h�@ � @ sJ d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z m
Z
ddlmZ ddl
mZmZmZmZ dd lmZ dd
lmZ ddlmZ ddlmZ ed
�Zdd� Zdd� Zdd� Zdd� Zd7dd�Zd8dd�Z dd� Z!dd� Z"dd� Z#d d!� Z$d7d"d#�Z%d$d%� Z&d&d'� Z'd(d)� Z(d*d+� Z)d,d-� Z*d.d/� Z+d9d1d2�Z,d8d3d4�Z-d5d6� Z.dS ):a�
This module contains helper functions for controlling caching. It does so by
managing the "Vary" header of responses. It includes functions to patch the
header of response objects directly and decorators that change functions to do
that header-patching themselves.
For information on the Vary header, see RFC 9110 Section 12.5.5.
Essentially, the "Vary" HTTP header defines which headers a cache should take
into account when building its cache key. Requests with the same path but
different header content for headers named in "Vary" need to get different
cache keys to prevent delivery of wrong content.
An example: i18n middleware would need to distinguish caches by the
"Accept-language" header.
� N)�defaultdict)�settings)�caches)�HttpResponse�HttpResponseNotModified)�md5)� http_date�parse_etags�parse_http_date_safe�
quote_etag)�log_response)�_lazy_re_compile)�get_current_timezone_name)�get_languagez\s*,\s*c
sl dd� }dd� � t t�}| �d�r2t�| jd �D ]}||�\�}�dkr-|� �|� q||�<