Debian Codegraph @

test/integration/targets/gathering_facts/cache_plugins/none.py

raw
1 # (c) 2014, Brian Coca, Josh Drake, et al
2 # (c) 2017 Ansible Project
3 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
5
6 from __future__ import annotations
7
8 from ansible.plugins.cache import BaseCacheModule
9
10 DOCUMENTATION = """
11 cache: none
12 short_description: write-only cache (no cache)
13 description:
14 - No caching at all
15 version_added: historical
16 author: core team (@ansible-core)
17 """
18
19
20 class CacheModule(BaseCacheModule):
21 def __init__(self, *args, **kwargs):
22 self.empty = {}
23
24 def get(self, key):
25 return self.empty.get(key)
26
27 def set(self, key, value):
28 return value
29
30 def keys(self):
31 return self.empty.keys()
32
33 def contains(self, key):
34 return key in self.empty
35
36 def delete(self, key):
37 del self.empty[key]
38
39 def flush(self):
40 self.empty = {}
41
42 def copy(self):
43 return self.empty.copy()
44
45 def __getstate__(self):
46 return self.copy()
47
48 def __setstate__(self, data):
49 self.empty = data