Documentation ¶
Index ¶
- Constants
- func DecrementCounter(key, table string) (int, *errors.Error)
- func IncrementCounter(key, table string) (int, *errors.Error)
- func RequestRateLimiter(ctx context.Context, sessionToken string) error
- func ResourceRateLimiter(ctx iris.Context)
- func SessionRateLimiter(ctx context.Context, userid string) error
Constants ¶
const ( // SessionRateLimit is table name to limit the number of requests per session SessionRateLimit = "SessionRateLimit" // UserRateLimit is table name to limit the number of sessions per user UserRateLimit = "UserRateLimit" // ResourceRateLimit is table name to limit the resource on time bound ResourceRateLimit = "ResourceRateLimit" )
Variables ¶
This section is empty.
Functions ¶
func DecrementCounter ¶
DecrementCounter will decrement the count
func IncrementCounter ¶
IncrementCounter will increment the count
func RequestRateLimiter ¶
RequestRateLimiter is for limiting number of requests per session here we will check if count which is added db against the session token if count is exceded the limit then return the response with too many requests, retry after some time if its not exceded then increment the counter and when the request completes the task then decrement the counter
func ResourceRateLimiter ¶
ResourceRateLimiter will Limit the get on resource untill previous get completed the task
func SessionRateLimiter ¶
SessionRateLimiter is for limiting number of sessions per user here we will check if count which is added db against the user id if count is exceded the limit then return the response with too many requests, retry after some time if its not exceded then incremen the counter and when the request completes the task then decrement the counter
Types ¶
This section is empty.