003 File Manager
Current Path:
/usr/local/lib/python3.8/site-packages/salt/sdb
usr
/
local
/
lib
/
python3.8
/
site-packages
/
salt
/
sdb
/
📁
..
📄
__init__.py
(29 B)
📁
__pycache__
📄
cache.py
(2.71 KB)
📄
confidant.py
(3.69 KB)
📄
consul.py
(1.68 KB)
📄
couchdb.py
(2.34 KB)
📄
env.py
(1.65 KB)
📄
etcd_db.py
(1.95 KB)
📄
keyring_db.py
(2.48 KB)
📄
memcached.py
(1.61 KB)
📄
redis_sdb.py
(1.72 KB)
📄
rest.py
(3.25 KB)
📄
sqlite3.py
(3.57 KB)
📄
tism.py
(2.16 KB)
📄
vault.py
(2.89 KB)
📄
yaml.py
(2.53 KB)
Editing: memcached.py
""" 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 """ import logging import salt.utils.memcached DEFAULT_HOST = "127.0.0.1" DEFAULT_PORT = 11211 DEFAULT_EXPIRATION = 0 log = logging.getLogger(__name__) __func_alias__ = {"set_": "set"} def __virtual__(): """ Only load the module if memcached is installed """ if salt.utils.memcached.HAS_LIBS: return True return False def set_(key, value, profile=None): """ Set a key/value pair in memcached """ conn = salt.utils.memcached.get_conn(profile) time = profile.get("expire", DEFAULT_EXPIRATION) return salt.utils.memcached.set_(conn, key, value, time=time) def get(key, profile=None): """ Get a value from memcached """ conn = salt.utils.memcached.get_conn(profile) return salt.utils.memcached.get(conn, key)
Upload File
Create Folder