Here's a simple way to do rate limiting based on a key and using incr.