�
�Udac @` s� d d l m Z m Z m Z e Z d Z d d l Z d d l Z d d l m
Z d d l m
Z
d d l m Z m Z d d l m Z d d l m Z y d d l m Z m Z Wn e k
r� e
d
� � n Xe � Z d e f d � � YZ d S(
i ( t absolute_importt divisiont print_functions
cache: redis
short_description: Use Redis DB for cache
description:
- This cache uses JSON formatted, per host records saved in Redis.
version_added: "1.9"
requirements:
- redis>=2.4.5 (python lib)
options:
_uri:
description:
- A colon separated string of connection information for Redis.
required: True
env:
- name: ANSIBLE_CACHE_PLUGIN_CONNECTION
ini:
- key: fact_caching_connection
section: defaults
_prefix:
description: User defined prefix to use when creating the DB entries
default: ansible_facts
env:
- name: ANSIBLE_CACHE_PLUGIN_PREFIX
ini:
- key: fact_caching_prefix
section: defaults
_timeout:
default: 86400
description: Expiration timeout for the cache plugin data
env:
- name: ANSIBLE_CACHE_PLUGIN_TIMEOUT
ini:
- key: fact_caching_timeout
section: defaults
type: integer
N( t constants( t AnsibleError( t AnsibleJSONEncodert AnsibleJSONDecoder( t BaseCacheModule( t Display( t StrictRedist VERSIONsl The 'redis' python module (version 2.4.5 or newer) is required for the redis fact cache, 'pip install redis't CacheModulec B` sz e Z d Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z
d � Z d
� Z d � Z
d � Z RS(
s
A caching module backed by redis.
Keys are maintained in a zset with their score being the timestamp
when they are inserted. This allows for the usage of 'zremrangebyscore'
to expire keys. This mechanism is used or a pattern matched 'scan' for
performance.
c O` s� g } yq t t | � j | | � | j d � rL | j d � j d � } n t | j d � � | _ | j d � | _ Wn` t k
r� t j
d d d �t j r� t j j d � } n t t j
� | _ t j | _ n Xi | _ t | � | _ d | _ d S( Nt _urit :t _timeoutt _prefixsT Rather than importing CacheModules directly, use ansible.plugins.loader.cache_loadert versions 2.12t ansible_cache_keys( t superR t __init__t
get_optiont splitt floatR R t KeyErrort displayt
deprecatedt Ct CACHE_PLUGIN_CONNECTIONt CACHE_PLUGIN_TIMEOUTt CACHE_PLUGIN_PREFIXt _cacheR t _dbt _keys_set( t selft argst kwargst
connection( ( s? /usr/lib/python2.7/site-packages/ansible/plugins/cache/redis.pyR F s"