def used
      return 0 if max.zero?

      expiry = redis.pttl(key)
      case expiry
      when -1  # key exists but has no associated expire
        raise Errors::InvalidKeyError, "Redis key #{key} has no expire time set"
      when -2  # key does not exist
        return 0
      end

      (max * expiry / (period * 1000.0)).ceil
    end
def used
      return 0 if max.zero?

      expiry = redis.pttl(key)
      case expiry
      when -1  # key exists but has no associated expire
        raise Errors::InvalidKeyError, "Redis key #{key} has no expire time set"
      when -2  # key does not exist
        return 0
      end

      (max * expiry / (period * 1000.0)).ceil
    end
Return amount of limit used, taking time drift into account.

 @return [Integer] amount used