diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-05 14:36:15 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-05 14:55:33 -0400 |
commit | cd7b0b3d40a5a340d5b47819f94a21c9faf23120 (patch) | |
tree | 67dc3b8f53b0921aade0ba5603d5f1c9cff85eb5 /src/lib/Bcfg2/Cache.py | |
parent | 84e8fc36c4d8524c8094daf31955dce8c0a624ea (diff) | |
download | bcfg2-cd7b0b3d40a5a340d5b47819f94a21c9faf23120.tar.gz bcfg2-cd7b0b3d40a5a340d5b47819f94a21c9faf23120.tar.bz2 bcfg2-cd7b0b3d40a5a340d5b47819f94a21c9faf23120.zip |
added server-side client metadata object caching
Diffstat (limited to 'src/lib/Bcfg2/Cache.py')
-rw-r--r-- | src/lib/Bcfg2/Cache.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Cache.py b/src/lib/Bcfg2/Cache.py new file mode 100644 index 000000000..9a828e2c9 --- /dev/null +++ b/src/lib/Bcfg2/Cache.py @@ -0,0 +1,12 @@ +""" An implementation of a simple memory-backed cache. Right now this +doesn't provide many features, but more (time-based expiration, etc.) +can be added as necessary. """ + +class Cache(dict): + """ an implementation of a simple memory-backed cache """ + def expire(self, key=None): + if key is None: + self.clear() + elif key in self: + del self[key] + |