File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/__pycache__/cache.cpython-310.pyc
Back
o ;j� � @ sJ d Z ddlZddiZdZdd� Zddd�Zdd d �Zddd�Zd d� Z dS )a� cache Module :maintainer: SaltStack :maturity: New :platform: all .. versionadded:: 2017.7.0 This module provides access to Salt's cache subsystem. Like all sdb modules, the cache 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 mastercloudcache: driver: cache bank: cloud/active/ec2/my-ec2-conf/saltmaster cachedir: /var/cache/salt The ``driver`` refers to the cache module, ``bank`` refers to the cache bank that contains the data and ``cachedir`` (optional), if used, points to an alternate directory for cache data storage. .. code-block:: yaml master_ip: sdb://mastercloudcache/public_ips It is also possible to override both the ``bank`` and ``cachedir`` options inside the SDB URI: .. code-block:: yaml master_ip: sdb://mastercloudcache/public_ips?cachedir=/var/cache/salt For this reason, both the ``bank`` and the ``cachedir`` options can be omitted from the SDB profile. However, if the ``bank`` option is omitted, it must be specified in the URI: .. code-block:: yaml master_ip: sdb://mastercloudcache/public_ips?bank=cloud/active/ec2/my-ec2-conf/saltmaster � N�set_�set�cachec C s t S )z6 Only load the module if keyring is installed )�__virtualname__� r r �B/opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/cache.py�__virtual__6 s r c C s8 t | |�\} }tj�t�}|�|d | |� t| ||�S )z3 Set a key/value pair in the cache service �bank)� _parse_key�saltr �Cache�__opts__�store�get)�key�value�service�profiler r r r r = s c C s, t | |�\} }tj�t�}|j|d | d�S )�, Get a value from the cache service r �r )r r r r r Zfetch�r r r r r r r r G s r c C sH t | |�\} }tj�t�}z|j|d | d� W dS ty# Y dS w )r r r TF)r r r r r �flush� Exceptionr r r r �deleteP s �r c C s` | � d�}t|�dkr |d � d�D ] }|� d�\}}|||<