'A database for rate limiting API requests.
It manages a table with (key, path, limit, time) entries.
It grants each key a rate (number of requests / time) for a URL path.
It keeps track of the number of requests in local memory (i.e., RAM).
If RateLimit()() is called with the optional limit and time arguments,
each IP address is granted this rate (even without a key).'

def __init__(self, name='rate.db', **kwargs):

    Database.__init__(self, name, **dict(kwargs, factory=None, schema='create    table    if    not    exists    `rate`    (`key`    text,`path`    text,`limit`    integer,`time`    float);create    index    if    not    exists    `rate1`    on    rate(key);create    index    if    not    exists    `rate2`    on    rate(path);'))
    self.load()
