AspNetCoreRateLimit
AspNetCoreRateLimit copied to clipboard
Use IOptionsSnapshot instead of IOptions
It would be useful to settings be dynamically read when changed, so usage of IOptionsSnapshot could be used instead of IOptions
to dynamically read one must support IOptionsMonitor, because IOptionsSnapshot is read once on class activation via DI, while Monitor can be dynamically changed in the same class instance.
I am not quite sure what value will this enhancement bring (considering the possible consequences..).
What options would you want to change at runtime?
Using IOptions causes configuration read once at startup.
Using IOptionsSnapshot cause configuration read every DI resolve
Using IOptionsMonitor allow change configuration dynamically without restart application.
@msmolka Since MemoryCacheIpPolicyStore provide some method of which you can re set your policies by your self. MemoryCacheIpPolicyStore is singleton too, have a worker watch for option change, you can achive dynamic policies.