Closed AndrewJo closed 5 years ago
Thank you @AndrewJo, great work! 👍
Thank you @AndrewJo, great work! 👍
You're welcome @masasron! I decided to write it after I realized that this provider doesn't consistently rate limit requests if I horizontally scale AdonisJs in Docker containers.
Please let me know when you plan on releasing v2.2.0 on npm.
Also, what are your plans for CI/CD for this package? I can help set up an automated release pipeline so that a new version tag would trigger a new npm release if you're interested.
@AndrewJo that would be great, let's talk
@masasron sounds good. I'll create a new issue. Let's move our conversation there.
This PR adds ability for users to extend adonis-throttle by providing custom cache drivers. Redis driver is included as a reference implementation. This PR should not break any backwards-compatibility and the minor version can be bumped as per SEMVER 2.0 specification.
Changes
Adonis/Addons/Throttle/Cache
abstract base class to ensure public API methods used byAdonis/Addons/Throttle
class are implemented by the user./src/Drivers/Cache/Memory
class to extendCache
abstract base class./src/Drivers/Cache/Redis
class as reference implementation@adonisjs/redis
as dependency to keep dependency tree small. The end-user is responsible for installing@adonisjs/redis
as dependency in their project should they wish to use the Redis driverinstructions
CLI hook (instructions.js
,instructions.md
)adonis install
CLI command, automatically addsconfig/throttle.js
to user's project and displays usage instructions