summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Cache.py
blob: 9a828e2c97d945e34387254e0f97210a92a98931 (plain)
1
2
3
4
5
6
7
8
9
10
11
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]