HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/__pycache__/cache.cpython-310.pyc
o

�N�g�
�@sJdZddlZddiZdZdd�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�cachecCstS)z6
    Only load the module if keyring is installed
    )�__virtualname__�rr�B/opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/cache.py�__virtual__6srcCs8t||�\}}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�profilerrrrr=scCs,t||�\}}tj�t�}|j|d|d�S)�,
    Get a value from the cache service
    r	�r)r
rrrr
Zfetch�rrrrrrrrGsrcCsHt||�\}}tj�t�}z|j|d|d�WdSty#YdSw)rr	rTF)r
rrrr
�flush�	Exceptionrrrr�deletePs�rcCs`|�d�}t|�dkr |d�d�D]
}|�d�\}}|||<qd|vr*|dtd<|d|fS)zD
    Parse out a key and update the opts with any override data
    �?��&�=Zcachedirr)�split�lenr
)rr�comps�itemZnewkeyZnewvalrrrr
]s

r
)NN)
�__doc__Z
salt.cacherZ__func_alias__rrrrrr
rrrr�<module>s.