No way to create custom key generator for storage
VladStepanov opened this issue · comments
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
I just want to have a opportunity to generate my own key. Md5 hash is good, but in real life there may be situations then you should connect to your redis and check keys rl-*
.
I can't believe that such a popular lib doesn't have such a simple thing.
Describe the solution you'd like
Global default customKey function
.forRoot({
customKey (context) {}
})
Local customKey function
class ThrottlerFoo extends ThrottlerGuard {
customKey (context) {}
}
Local function overrides global
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
In real life there may be situations then you should connect to your redis and check/drop constraints
You can extend the ThrottlerGuard
and override the generateKey
method
I think this should be highlighted in the documentation.
@yudikubota feel free to open a PR to change that at https://github.com/nestjs/docs.nestjs.com