Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/dogpile/cache/backends/__pycache__/valkey.cpython-39.pyc
Ðазад
a t�h�M � @ s� d Z ddlZddlZddlmZ ddlmZ ejr<ddlandadZG dd� de�Z G d d � d �Z G dd� de �ZG d d� de �ZdS )ze Valkey Backends ------------------ Provides backends for talking to `Valkey <http://valkey.io>`_. � N� )�BytesBackend��NO_VALUE)� ValkeyBackend�ValkeySentinelBackend�ValkeyClusterBackendc @ s` e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dS )r aZ A `Valkey <http://valkey.io/>`_ backend, using the `valkey-py <http://pypi.python.org/pypi/valkey/>`_ driver. .. versionadded:: 1.3.4 Example configuration:: from dogpile.cache import make_region region = make_region().configure( 'dogpile.cache.valkey', arguments = { 'host': 'localhost', 'port': 6379, 'db': 0, 'valkey_expiration_time': 60*60*2, # 2 hours 'distributed_lock': True, 'thread_local_lock': False } ) Arguments accepted in the arguments dictionary: :param url: string. If provided, will override separate host/username/password/port/db params. The format is that accepted by ``StrictValkey.from_url()``. :param host: string, default is ``localhost``. :param username: string, default is no username. :param password: string, default is no password. :param port: integer, default is ``6379``. :param db: integer, default is ``0``. :param valkey_expiration_time: integer, number of seconds after setting a value that Valkey should expire it. This should be larger than dogpile's cache expiration. By default no expiration is set. :param distributed_lock: boolean, when True, will use a valkey-lock as the dogpile lock. Use this when multiple processes will be talking to the same valkey instance. When left at False, dogpile will coordinate on a regular threading mutex. :param lock_timeout: integer, number of seconds after acquiring a lock that Valkey should expire it. This argument is only valid when ``distributed_lock`` is ``True``. :param socket_timeout: float, seconds for socket timeout. Default is None (no timeout). :param socket_connect_timeout: float, seconds for socket connection timeout. Default is None (no timeout). :param socket_keepalive: boolean, when True, socket keepalive is enabled. Default is False. :param socket_keepalive_options: dict, socket keepalive options. Default is None (no options). :param lock_sleep: integer, number of seconds to sleep when failed to acquire a lock. This argument is only valid when ``distributed_lock`` is ``True``. :param connection_pool: ``valkey.ConnectionPool`` object. If provided, this object supersedes other connection arguments passed to the ``valkey.StrictValkey`` instance, including url and/or host as well as socket_timeout, and will be passed to ``valkey.StrictValkey`` as the source of connectivity. :param thread_local_lock: bool, whether a thread-local Valkey lock object should be used. This is the default, but is not compatible with asynchronous runners, as they run in a different thread than the one used to create the lock. :param connection_kwargs: dict, additional keyword arguments are passed along to the ``StrictValkey.from_url()`` method or ``StrictValkey()`` constructor directly, including parameters like ``ssl``, ``ssl_certfile``, ``charset``, etc. c C s |� � }| �� |�dd �| _|�dd�| _|�dd �| _|�dd �| _|�dd�| _|�dd �| _|�d d�| _ |�dd �| _ |�d d �| _|�dd�| _|�dd �| _ |�dd �| _|�dd�| _|�dd�| _|�di �| _| j r�| jr�t�d� |�dd �| _|�dd �| _| �� d S )N�url�host� localhost�username�password�porti� �dbr �distributed_lockF�socket_timeout�socket_connect_timeout�socket_keepalive�socket_keepalive_options�lock_timeout� lock_sleepg�������?�thread_local_lockT�connection_kwargszcThe Valkey backend thread_local_lock parameter should be set to False when distributed_lock is True�valkey_expiration_time�connection_pool)�copy�_imports�popr r r r r r r r r r r r r r r �warnings�warnr r �_create_client��self� arguments� r$ ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/dogpile/cache/backends/valkey.py�__init__p s<