mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
parent
2f33c1a1a1
commit
5553b20828
206 changed files with 1853 additions and 1870 deletions
3
lib/ansible/plugins/cache/redis.py
vendored
3
lib/ansible/plugins/cache/redis.py
vendored
|
@ -30,6 +30,7 @@ try:
|
|||
except ImportError:
|
||||
raise AnsibleError("The 'redis' python module is required for the redis fact cache, 'pip install redis'")
|
||||
|
||||
|
||||
class CacheModule(BaseCacheModule):
|
||||
"""
|
||||
A caching module backed by redis.
|
||||
|
@ -65,7 +66,7 @@ class CacheModule(BaseCacheModule):
|
|||
|
||||
def set(self, key, value):
|
||||
value2 = json.dumps(value)
|
||||
if self._timeout > 0: # a timeout of 0 is handled as meaning 'never expire'
|
||||
if self._timeout > 0: # a timeout of 0 is handled as meaning 'never expire'
|
||||
self._cache.setex(self._make_key(key), int(self._timeout), value2)
|
||||
else:
|
||||
self._cache.set(self._make_key(key), value2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue