Kuadrant / limitador

Rate limiter
Apache License 2.0
60 stars 21 forks source link

Support providing an optional id to limits/counters #356

Closed chirino closed 4 months ago

chirino commented 5 months ago
chirino commented 4 months ago

moving the id out of the constuctor drastically reduced the size of the change set.

chirino commented 4 months ago

@alexsnaps redis keys will now encode using shorter binary encoding only when the id is set.

chirino commented 4 months ago

after running the rate_limited_id_counter_with_sync_redis the keys in redis look like:

root@255340cd3402:/data# redis-cli --scan --pattern '*'
"\x02\x1ctest-rate_limited_id_counter"
"\x02\x1ctest-rate_limited_id_counter\x01\x06app_id\x0btest_app_id"
chirino commented 4 months ago

Since I'm new to rust, I'm not sure about the "Should we push the version in our cargo.toml to 2.0.0-dev (and 1.0.0-dev for the crate)?" bit. I think this change does not break backward compact so I don't know if it needs a major rev.