def _purge_expired_items()

in fxa/cache.py [0:0]


    def _purge_expired_items(self, now):
        while self.expiry_queue:
            (expires_at, key) = self.expiry_queue[0]
            if expires_at >= now:
                break
            # The item is expired, remove it.
            # Careful though, it may have been replaced
            # with a newer value after its expiry was enqueued.
            self.expiry_queue.popleft()
            try:
                item = self.cache.pop(key)
            except KeyError:
                pass
            else:
                if item[1] > now:
                    # It's been replaced, put it back.
                    self.cache[key] = item