Class: RateLimit::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/ratelimit/bucketbased.rb

Overview

  • Returns :

    • a Bucket

  • Raises :

    • ArgumentError -> if any value is nil or negative

Direct Known Subclasses

Memory, MySQL

Instance Method Summary collapse

Instance Method Details

#get(name) ⇒ Object

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

Raises:

  • (NoMethodError)


53
54
55
# File 'lib/ratelimit/bucketbased.rb', line 53

def get(name)
	raise NoMethodError
end

#set(bucket) ⇒ Object

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

Raises:

  • (NoMethodError)


64
65
66
# File 'lib/ratelimit/bucketbased.rb', line 64

def set(bucket)
	raise NoMethodError
end

#update(bucket) ⇒ Object

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

Raises:

  • (NoMethodError)


76
77
78
# File 'lib/ratelimit/bucketbased.rb', line 76

def update(bucket)
	raise NoMethodError
end