Skip to content

rshemant/rate-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rate-Limiter (Singleton / Factory / Strategy Example)

This sample Java project demonstrates how to implement API Rate Limiting in a framework-agnostic way using classic design patterns:

  1. Singleton (for centralized configuration)
  2. Strategy (to allow different rate-limiting algorithms)
  3. Factory (to decide which strategy to use at runtime)

It includes:

  • Fixed Window rate-limiter (FixedWindowRL)
  • Sliding Window rate-limiter (SlidingWindowRL)
  • A Servlet Filter example (RateLimitingFilter) to show how to integrate into a typical web environment
  • A standalone demo class (MainDemo) for quick testing

How to run project

Run the code from com.example.ratelimit.demo.MainDemo

what design patterns are used

  • Factory
  • Strategy
  • Singleton

what principles are followed

  • SOILD

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages