class RateLimit::Storage

“Storage” is a jerk class that throws exceptions if you forgot to implement a critical function, welcome to Ruby (no interface) Bucket tracks the credits for each item. Each bucket has the following parameters:

Public Instance Methods

get(name) click to toggle source

retrieves a named bucket

  • Args :

    • name -> the name of the bucket to be retrieved

  • Returns :

    • the bucket matching the name if found, nil otherwise

  • Raises :

    • NoMethodError -> always, because this class is a jerk

# File lib/ratelimit/bucketbased.rb, line 53
def get(name)
        raise NoMethodError
end
set(bucket) click to toggle source

saves a bucket into the storage

  • Args :

    • bucket -> the Bucket to set. The name field in the Bucket option will be used as a key.

  • Returns :

    • nil

  • Raises :

    • NoMethodError -> always, because this class is a jerk

# File lib/ratelimit/bucketbased.rb, line 64
def set(bucket)
        raise NoMethodError
end
update(bucket) click to toggle source

updates the key fields that need updating into the storage this is often cheaper for certain types of storage than using set()

  • Args :

    • bucket -> the Bucket to update. The name field in the Bucket option will be used as a key.

  • Returns :

    • nil

  • Raises :

    • NoMethodError -> always, because this class is a jerk

# File lib/ratelimit/bucketbased.rb, line 76
def update(bucket)
        raise NoMethodError
end