File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/__pycache__/memcached.cpython-310.pyc
o
�N�gt � @ sR d Z ddlZddlZdZdZdZe�e�Z ddiZ
dd� Zdd d�Zdd
d�Z
dS )
a]
Memcached sdb Module
:maintainer: SaltStack
:maturity: New
:depends: python-memcached
:platform: all
This module allows access to memcached using an ``sdb://`` URI. This
package is located at ``https://pypi.python.org/pypi/python-memcached``.
Like all sdb modules, the memcached module requires a configuration profile to
be configured in either the minion or master configuration file. This profile
requires very little. In the example:
.. code-block:: yaml
mymemcache:
driver: memcached
memcached.host: localhost
memcached.port: 11211
The ``driver`` refers to the memcached module, ``host`` and ``port`` the
memcached server to connect to (defaults to ``localhost`` and ``11211``,
and ``mymemcached`` refers to the name that will appear in the URI:
.. code-block:: yaml
password: sdb://mymemcached/mykey
� Nz 127.0.0.1i�+ �set_�setc C s t jjjrdS dS )z8
Only load the module if memcached is installed
TF)�salt�utils� memcachedZHAS_LIBS� r r �F/opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/memcached.py�__virtual__. s
r c C s0 t jj�|�}|�dt�}t jjj|| ||d�S )z+
Set a key/value pair in memcached
Zexpire)�time)r r r �get_conn�get�DEFAULT_EXPIRATIONr )�key�value�profile�connr
r r r r 7 s c C s t jj�|�}t jj�|| �S )z$
Get a value from memcached
)r r r r r )r r r r r r r @ s r )N)�__doc__�loggingZsalt.utils.memcachedr ZDEFAULT_HOSTZDEFAULT_PORTr
� getLogger�__name__�logZ__func_alias__r r r r r r r �<module> s