Class RateLimitingRedisStorePlugin
java.lang.Object
io.vertigo.vega.plugins.ratelimiting.redis.RateLimitingRedisStorePlugin
- All Implemented Interfaces:
io.vertigo.core.node.component.CoreComponent,io.vertigo.core.node.component.Plugin,RateLimitingStorePlugin
Rate limiting counting redis storage.
- Author:
- npiedeloup
-
Constructor Summary
ConstructorsConstructorDescriptionRateLimitingRedisStorePlugin(Optional<String> connectorNameOpt, List<io.vertigo.connectors.redis.RedisConnector> redisConnectors) -
Method Summary
Modifier and TypeMethodDescriptionvoidbanishUntil(String userKey, Instant banishUntil) Set banish until instant for a userKey.voidCancel all banishments.voidcancelBanishment(String userKey) Cancel banishment of a userkey.voidextendsWindow(String userKey, long newWindowSeconds) getBanishInstant(String userKey) Get banish until instant.longgetFirstHitAgeSecond(String userKey) Get first hit age for a userKey.intincrementBanishCounter(String userKey, long maxBanishSeconds) Prepare banishment, increment and get banish counter.longremainingSeconds(String userKey) Get remaining seconds in window for a userKey.longHit count by userKey, over a window.
-
Constructor Details
-
RateLimitingRedisStorePlugin
-
-
Method Details
-
touch
Description copied from interface:RateLimitingStorePluginHit count by userKey, over a window.- Specified by:
touchin interfaceRateLimitingStorePlugin- Parameters:
userKey- user key (like ip)incrBy- increment bywindowSeconds- window in seconds
-
extendsWindow
- Specified by:
extendsWindowin interfaceRateLimitingStorePlugin
-
getFirstHitAgeSecond
Description copied from interface:RateLimitingStorePluginGet first hit age for a userKey.- Specified by:
getFirstHitAgeSecondin interfaceRateLimitingStorePlugin- Parameters:
userKey- userKey user key (like ip)- Returns:
- age in second (-1 if unknown)
-
remainingSeconds
Description copied from interface:RateLimitingStorePluginGet remaining seconds in window for a userKey.- Specified by:
remainingSecondsin interfaceRateLimitingStorePlugin- Parameters:
userKey- user key (like ip)
-
incrementBanishCounter
Description copied from interface:RateLimitingStorePluginPrepare banishment, increment and get banish counter.- Specified by:
incrementBanishCounterin interfaceRateLimitingStorePlugin- Parameters:
userKey- user key (like ip)maxBanishSeconds- max seconds counting banishment (each banish reset this time)- Returns:
- current banish counter
-
banishUntil
Description copied from interface:RateLimitingStorePluginSet banish until instant for a userKey.- Specified by:
banishUntilin interfaceRateLimitingStorePlugin- Parameters:
userKey- userKey user key (like ip)banishUntil- banish until instant
-
getBanishInstant
Description copied from interface:RateLimitingStorePluginGet banish until instant.- Specified by:
getBanishInstantin interfaceRateLimitingStorePlugin- Parameters:
userKey- user key (like ip)- Returns:
- banish until instant.
-
cancelBanishment
Description copied from interface:RateLimitingStorePluginCancel banishment of a userkey.- Specified by:
cancelBanishmentin interfaceRateLimitingStorePlugin- Parameters:
userKey- user key to reset
-
cancelAllBanishments
public void cancelAllBanishments()Description copied from interface:RateLimitingStorePluginCancel all banishments.- Specified by:
cancelAllBanishmentsin interfaceRateLimitingStorePlugin
-
getBanishments
- Specified by:
getBanishmentsin interfaceRateLimitingStorePlugin- Returns:
- current banished userKey
-