Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
db_set () {
echo "$1,$2" >> database
}
db_get () {
grep "^$1," database | sed -e "s/^$1,//" | tail -n 1
}
db_set video1 '1'
@shivakumar3456
shivakumar3456 / FixedWindowRateLimiter.java
Last active September 14, 2023 13:49
Fixed Window RateLimiter implementation using Java and Redis
@RestController
@RequestMapping("/ratelimiter")
public class FixedWindowRateLimiter {
private final @NotNull Jedis jedis;
public FixedWindowRateLimiter(@NotNull Jedis jedis){
this.jedis = jedis;