vutran1710 / PyrateLimiter

⚔️Python Rate-Limiter using Leaky-Bucket Algorithm Family
https://pyratelimiter.readthedocs.io
MIT License
338 stars 36 forks source link

Feature request/proposal: SQLite support #37

Closed JWCook closed 2 years ago

JWCook commented 3 years ago

I think a SQLite-backed bucket would be a nice addition to this library, as it fits a gap between the current memory and Redis options. I don't need this immediately, but will in the future. Here's my use case:

I have a library that currently uses pyrate-limiter, and at some point I'll add a CLI tool that wraps that library. An in-memory bucket won't work because it will only stay in memory for the duration of a single CLI invocation. Redis is a good option, but most users won't have Redis set up on their local machine.

I think SQLite would be a good fit here, because it's simple, fast, and part of the standard library. I would be willing to work on this. If needed, async support could be added later on via aiosqlite.

What do you think?

vutran1710 commented 3 years ago

Sounds reasonable to me. I'll be helping if needed.