def limit(self, key):
        """
        Function to log an event with the given key. If the ``key`` has not
        exceeded their alotted events, then the function returns ``False`` to
        indicate that no limit is being imposed.

        If the ``key`` has exceeded the number of events, then the function
        returns ``True`` indicating rate-limiting should occur.

        :param str key: A key identifying the source of the event.
        :returns: Boolean indicating whether the event should be rate-limited
            or not.
        """
        if self._debug:
            return False

        counter = self.database.List(self.name + ':' + key)
        n = len(counter)
        is_limited = False
        if n < self._limit:
            counter.prepend(str(time.time()))
        else:
            oldest = float(counter[-1])
            if time.time() - oldest < self._per:
                is_limited = True
            else:
                counter.prepend(str(time.time()))
            del counter[:self._limit]
        counter.pexpire(int(self._per * 2000))
        return is_limited