%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/names/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/names/__pycache__/cache.cpython-312.pyc

�

Ϫ�f���^�dZddlmZddlmZmZddlmZmZGd�dej�Z
y)z 
An in-memory caching resolver.
�)�defer)�common�dns)�failure�logc�D�eZdZdZdZd
d�Zd�Zd�Zd�Zdd�Z	dd�Z
d	�Zy)�
CacheResolverz�
    A resolver that serves records from a local, memory cache.

    @ivar _reactor: A provider of L{interfaces.IReactorTime}.
    Nc���tjj|�i|_||_i|_|�ddlm}||_|r/|j�D]\}\}}|j|||��yy)Nr)�reactor)r�ResolverBase�__init__�cache�verbose�cancel�twisted.internetr�_reactor�items�cacheResult)�selfrrr�query�seconds�payloads       �5/usr/lib/python3/dist-packages/twisted/names/cache.pyr
zCacheResolver.__init__ss�����$�$�T�*���
��������?�0���
��-2�[�[�]�
:�)��)���� � ����9�
:��c��||_|jj�}|jj	�D]<\}\}\}}}||z
}||z|zD] }	|	j
|ks�|j|=�<�>y�N)�__dict__rrrr�ttl)
r�state�now�k�when�ans�add�ns�diff�recs
          r�__setstate__zCacheResolver.__setstate__&s�����
��m�m�#�#�%��)-���)9�)9�);�	�%�A�%��n�s�C����:�D��S�y�2�~�
���7�7�T�>��
�
�1�
��
�	rc��|jj�D]}|j��|jj�|jSr)r�values�clearr)r�cs  r�__getstate__zCacheResolver.__getstate__1sA�����#�#�%�	�A�
�H�H�J�	��������}�}�rc�*�|jj�}tj|||�}	|j|\}\}}	}
|j
r!t
jdt|�z�||z
}	|D�cgc]Z}tj|jj|j|j|j|z
|j���\c}|	D�cgc]Z}tj|jj|j|j|j|z
|j���\c}|
D�cgc]Z}tj|jj|j|j|j|z
|j���\c}f}
tj |
�Scc}wcc}wcc}w#t"$r>tj$t'j(tj*|���cYSwxYw#t,$rn|j
dkDr!t
jdt|�z�tj$t'j(tj*|���cYSwxYw)NzCache hit for �zCache miss for )rrr�Queryrrr�msg�repr�RRHeader�name�type�clsrrr�succeed�
ValueError�failr�Failure�DomainError�KeyError)rr4r6r5�timeoutr �qr"r#�authr$r&�r�results              r�_lookupzCacheResolver._lookup7s����m�m�#�#�%���I�I�d�D�#�&��#	-�%)�Z�Z��]�"�D�"�3��c��|�|����(�4��:�5�6���:�D�
-�"%�	������F�F�K�K������������a�i�i���"&�	������F�F�K�K������������a�i�i���"%�	������F�F�K�K������������a�i�i�����.�}�}�V�,�,��-�������
J��z�z�'�/�/�#�/�/�$�2G�"H�I�I�
J��=�	F��|�|�a�����)�D��J�6�7��:�:�g�o�o�c�o�o�d�.C�D�E�E�	F�sR�H�<G�AG�G�%AG�G�
AG�)G�G�AH�H�A4J�Jc�x�tjtjt	j
|���Sr)rr9rr:rr;)rr4r=s   r�lookupAllRecordszCacheResolver.lookupAllRecords_s#���z�z�'�/�/�#�/�/�$�*?�@�A�Arc�$�|jdkDrtjd|z�|xs|jj	�|f|j
|<||jvr|j|j
�t|d�t|d�zt|d�z}|r-|dj}|D]}t||j�}�nd}|jj||j|�|j|<y)a�
        Cache a DNS entry.

        @param query: a L{dns.Query} instance.

        @param payload: a 3-tuple of lists of L{dns.RRHeader} records, the
            matching result of the query (answers, authority and additional).

        @param cacheTime: The time (seconds since epoch) at which the entry is
            considered to have been added to the cache. If L{None} is given,
            the current time is used.
        r/zAdding %r to cacher�N)rrr1rrrr�listr�min�	callLater�
clearEntry)rrr�	cacheTime�s�mr@s       rrzCacheResolver.cacheResultbs����<�<�!���G�G�(�5�0�1�&�A�$�-�-�*?�*?�*A�7�K��
�
�5���D�K�K���K�K���%�%�'������t�G�A�J�/�/�$�w�q�z�2B�B����!����A��
"����1�5�5�M��
"��A�!�]�]�4�4�Q�����O����E�rc�8�|j|=|j|=yr)rr)rrs  rrJzCacheResolver.clearEntry�s���J�J�u���K�K��r)NrNr)�__name__�
__module__�__qualname__�__doc__rr
r(r-rBrDrrJ�rrr	r	s4���
�E�:�	��&-�PB�P�>rr	N)rRrr�
twisted.namesrr�twisted.pythonrrrr	rSrr�<module>rVs)��
�
#�%�'�t�F�'�'�tr

Zerion Mini Shell 1.0