Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ICache ¶
type ICache interface { AddCounter(ip string, duration time.Duration) IsAllowed(ip string, requestNumber int) bool }
func GetCacheHandler ¶
func GetCacheHandler(name RateLimitCacheType) ICache
GetCacheHandler cache builder ( factory method )
type RateLimitCacheType ¶ added in v0.1.1
type RateLimitCacheType int8
const (
RedisBackend RateLimitCacheType = iota
)
type Redis ¶
Redis struct that implement ICache interface
func (Redis) AddCounter ¶
AddCounter create or increment user rate
Click to show internal directories.
Click to hide internal directories.