This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Runtime.Caching; | |
| namespace Hasin.Taaghche.Utilities | |
| { | |
| // Use this class to put restriction on the number of invocations of an endpoint in your system by a given input. | |
| // E.g., when a user wants to login with "test@test.com", call CanProceed("test@test.com") to check if she can do that. | |
| public class RateLimiter | |
| { | |
| private readonly MemoryCache _cache; |