speedbump.go
func (r *RateLimiter) Attempted(id string) (int64, error) {
	hash := r.hasher.Hash(id)
	val, err := r.redisClient.Get(hash).Result()

	if err != nil {
		if err == redis.Nil {
			// Key does not exist. See: http://redis.io/commands/GET
			return 0, nil
		}
		return 0, err
	}

	if err != nil {
		return 0, err
	}

	return strconv.ParseInt(val, 10, 64)
}
func (r *RateLimiter) Attempted(id string) (int64, error) {
	hash := r.hasher.Hash(id)
	val, err := r.redisClient.Get(hash).Result()

	if err != nil {
		if err == redis.Nil {
			// Key does not exist. See: http://redis.io/commands/GET
			return 0, nil
		}
		return 0, err
	}

	if err != nil {
		return 0, err
	}

	return strconv.ParseInt(val, 10, 64)
}
func ( r * RateLimiter ) Attempted ( id string ) ( int64 , error ) { hash := r . hasher . Hash ( id ) val , err := r . redisClient . Get ( hash ) . Result ( ) if err != nil { if err == redis . Nil { // Key does not exist. See: http://redis.io/commands/GET return 0 , nil } return 0 , err } if err != nil { return 0 , err } return strconv . ParseInt ( val , 10 , 64 ) }
// Attempted returns the number of attempted requests for an id in the current
// period. Attempted does not count attempts that exceed the max requests in an
// interval and only returns the max count after this is reached.
Attempted returns the number of attempted requests for an id in the current period . Attempted does not count attempts that exceed the max requests in an interval and only returns the max count after this is reached .