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
6from __future__ import (absolute_import, division, print_function)
7__metaclass__ = type
8
9from ansible.plugins.cache import BaseCacheModule
10
11DOCUMENTATION = '''
12    cache: none
13    short_description: write-only cache (no cache)
14    description:
15        - No caching at all
16    version_added: historical
17    author: core team (@ansible-core)
18'''
19
20
21class CacheModule(BaseCacheModule):
22    def __init__(self, *args, **kwargs):
23        self.empty = {}
24
25    def get(self, key):
26        return self.empty.get(key)
27
28    def set(self, key, value):
29        return value
30
31    def keys(self):
32        return self.empty.keys()
33
34    def contains(self, key):
35        return key in self.empty
36
37    def delete(self, key):
38        del self.emtpy[key]
39
40    def flush(self):
41        self.empty = {}
42
43    def copy(self):
44        return self.empty.copy()
45
46    def __getstate__(self):
47        return self.copy()
48
49    def __setstate__(self, data):
50        self.empty = data
51