(self, key, ttl)
Remove all the items in the cache for the given key that are older than
        ttl seconds.
        If the key is not in the cache, raises a KeyError.
Remove all the items in the cache for the given key that are older than
        ttl seconds.
        If the key is not in the cache, raises a KeyError.
Remove all the items in the cache for the given key that are older than ttl seconds . If the key is not in the cache raises a KeyError .
def purge(self, key, ttl):
        """
        Remove all the items in the cache for the given key that are older than
        ttl seconds.
        If the key is not in the cache, raises a KeyError.
        """
        mors_to_purge = []
        now = time.time()
        with self._mor_lock:
            # Don't change the dict during iteration!
            # First collect the names of the Mors to remove...
            for name, mor in iteritems(self._mor[key]):
                age = now - mor['creation_time']
                if age > ttl:
                    mors_to_purge.append(name)

            # ...then actually remove the Mors from the cache.
            for name in mors_to_purge:
                del self._mor[key][name]
def purge ( self , key , ttl ) : mors_to_purge = [ ] now = time . time ( ) with self . _mor_lock : # Don't change the dict during iteration! # First collect the names of the Mors to remove... for name , mor in iteritems ( self . _mor [ key ] ) : age = now - mor [ 'creation_time' ] if age > ttl : mors_to_purge . append ( name ) # ...then actually remove the Mors from the cache. for name in mors_to_purge : del self . _mor [ key ] [ name ]