Liking cljdoc? Tell your friends :D

resilience.ratelimiter


*creation-time*clj

Contextual value represents event create time

Contextual value represents event create time
sourceraw docstring

*rate-limiter-name*clj

Contextual value represents rate limiter name

Contextual value represents rate limiter name
sourceraw docstring

acquire-permission!clj

(acquire-permission! limiter timeout-millis)

Acquires a permission from this rate limiter, blocking until one is available.

Acquires a permission from this rate limiter, blocking until one is available.
sourceraw docstring

change-limit-for-period!clj

(change-limit-for-period! limiter limit)

Dynamic rate limiter configuration change. This method allows to change count of permissions available during refresh period. NOTE! New limit won't affect current period permissions and will apply only from next one.

Dynamic rate limiter configuration change.
This method allows to change count of permissions available during refresh period.
NOTE! New limit won't affect current period permissions and will apply only from next one.
sourceraw docstring

change-timeout-millis!clj

(change-timeout-millis! limiter timeout-millis)

Dynamic rate limiter configuration change. This method allows to change timeout-millis of current limiter. NOTE! New timeout-millis won't affect threads that are currently waiting for permission.

Dynamic rate limiter configuration change.
This method allows to change timeout-millis of current limiter.
NOTE! New timeout-millis won't affect threads that are currently waiting for permission.
sourceraw docstring

configclj

(config limiter)

Get the RateLimiterConfig of this RateLimiter

Get the RateLimiterConfig of this RateLimiter
sourceraw docstring

defratelimitercljmacro

(defratelimiter name)
(defratelimiter name config)

Define a rate limiter under name with a default or custom rate limiter configuration.

Please refer to rate-limiter-config for allowed key value pairs within the rate limiter configuration.

If you want to register this rate limiter to a RateLimiterRegistry, you need to put :registry key with a RateLimiterRegistry in the config argument. If you do not provide any other configurations, the newly created rate limiter will inherit rate limiter configurations from this provided RateLimiterRegistry Example: (defratelimiter my-rate-limiter {:registry my-registry})

If you want to register this rate limiter to a RateLimiterRegistry and you want to use new rate limiter configurations to overwrite the configurations inherited from the registered RateLimiterRegistry, you need not only provide the :registry key with the RateLimiterRegistry in config argument but also provide other rate limiter configurations you'd like to overwrite. Example: (defratelimiter my-rate-limiter {:registry my-registry :timeout-millis 50})

If you only want to create a rate limiter and not register it to any RateLimiterRegistry, you just need to provide rate limiter configuration in config argument without :registry keyword.

Define a rate limiter under `name` with a default or custom rate limiter configuration.

Please refer to `rate-limiter-config` for allowed key value pairs
within the rate limiter configuration.

If you want to register this rate limiter to a RateLimiterRegistry,
you need to put :registry key with a RateLimiterRegistry in the `config`
argument. If you do not provide any other configurations, the newly created
rate limiter will inherit rate limiter configurations from this
provided RateLimiterRegistry
Example:
(defratelimiter my-rate-limiter {:registry my-registry})

If you want to register this rate limiter to a RateLimiterRegistry
and you want to use new rate limiter configurations to overwrite the configurations
inherited from the registered RateLimiterRegistry,
you need not only provide the :registry key with the RateLimiterRegistry in `config`
argument but also provide other rate limiter configurations you'd like to overwrite.
Example:
(defratelimiter my-rate-limiter {:registry my-registry
                                 :timeout-millis 50})

If you only want to create a rate limiter and not register it to any
RateLimiterRegistry, you just need to provide rate limiter configuration in `config`
argument without :registry keyword.
sourceraw docstring

defregistrycljmacro

(defregistry name)
(defregistry name config)

Define a RateLimiterRegistry under name with a default or custom rate limiter configuration.

Please refer to rate-limiter-config for allowed key value pairs within the rate limiter configuration map.

Define a RateLimiterRegistry under `name` with a default or custom
rate limiter configuration.

Please refer to `rate-limiter-config` for allowed key value pairs
within the rate limiter configuration map.
sourceraw docstring

get-all-rate-limitersclj

(get-all-rate-limiters registry)

Get all rate limiters registered to this rate limiter registry instance

Get all rate limiters registered to this rate limiter registry instance
sourceraw docstring

metricsclj

(metrics limiter)

Get the Metrics of this RateLimiter.

Get the Metrics of this RateLimiter.
sourceraw docstring

nameclj

(name limiter)

Get the name of this RateLimiter

Get the name of this RateLimiter
sourceraw docstring

rate-limiterclj

(rate-limiter name)
(rate-limiter name config)

Create a rate limiter with a name and a default or custom rate limiter configuration.

The name argument is only used to register this newly created rate limiter to a RateLimiterRegistry. If you don't want to bind this rate limiter with a RateLimiterRegistry, the name argument is ignored.

Please refer to rate-limiter-config for allowed key value pairs within the rate limiter configurations map.

If you want to register this rate limiter to a RateLimiterRegistry, you need to put :registry key with a RateLimiterRegistry in the config argument. If you do not provide any other configurations, the newly created rate limiter will inherit rate limiter configurations from this provided RateLimiterRegistry Example: (rate-limiter my-rate-limiter {:registry my-registry})

If you want to register this rate limiter to a RateLimiterRegistry and you want to use new rate limiter configurations to overwrite the configurations inherited from the registered RateLimiterRegistry, you need not only provide the :registry key with the RateLimiterRegistry in config argument but also provide other rate limiter configurations you'd like to overwrite. Example: (rate-limiter my-rate-limiter {:registry my-registry :timeout-millis 50})

If you only want to create a rate limiter and not register it to any RateLimiterRegistry, you just need to provide rate limiter configurations in config argument. The name argument is ignored.

Create a rate limiter with a `name` and a default or custom rate limiter configuration.

The `name` argument is only used to register this newly created rate limiter
to a RateLimiterRegistry. If you don't want to bind this rate limiter with
a RateLimiterRegistry, the `name` argument is ignored.

Please refer to `rate-limiter-config` for allowed key value pairs
within the rate limiter configurations map.

If you want to register this rate limiter to a RateLimiterRegistry,
you need to put :registry key with a RateLimiterRegistry in the `config`
argument. If you do not provide any other configurations, the newly created
rate limiter will inherit rate limiter configurations from this
provided RateLimiterRegistry
Example:
(rate-limiter my-rate-limiter {:registry my-registry})

If you want to register this rate limiter to a RateLimiterRegistry
and you want to use new rate limiter configurations to overwrite the configurations
inherited from the registered RateLimiterRegistry,
you need not only provide the :registry key with the RateLimiterRegistry in `config`
argument but also provide other rate limiter configurations you'd like to overwrite.
Example:
(rate-limiter my-rate-limiter {:registry my-registry
                               :timeout-millis 50})

If you only want to create a rate limiter and not register it to any
RateLimiterRegistry, you just need to provide rate limiter configurations in `config`
argument. The `name` argument is ignored.
sourceraw docstring

rate-limiter-configclj

(rate-limiter-config opts)

Create a RateLimiterConfig.

Allowed options are:

  • :timeout-millis Configures the default wait for permission duration. Default value is 5000 milliseconds.

  • :limit-for-period Configures the permissions limit for refresh period. Count of permissions available during one rate limiter period specified by :limit-refresh-period-nanos value. Default value is 50.

  • :limit-refresh-period-nanos Configures the period of limit refresh. After each period rate limiter sets its permissions count to :limit-for-period value. Default value is 500 nanoseconds.

Create a RateLimiterConfig.

Allowed options are:
* :timeout-millis
  Configures the default wait for permission duration.
  Default value is 5000 milliseconds.

* :limit-for-period
  Configures the permissions limit for refresh period.
  Count of permissions available during one rate limiter period specified by
  :limit-refresh-period-nanos value.
  Default value is 50.

* :limit-refresh-period-nanos
  Configures the period of limit refresh.
  After each period rate limiter sets its permissions count to :limit-for-period value.
  Default value is 500 nanoseconds.
 
sourceraw docstring

registry-with-configclj

(registry-with-config config)

Create a RateLimiterRegistry with a rate limiter configurations map.

Please refer to rate-limiter-config for allowed key value pairs within the rate limiter configuration map.

Create a RateLimiterRegistry with a rate limiter configurations map.

Please refer to `rate-limiter-config` for allowed key value pairs
within the rate limiter configuration map.
sourceraw docstring

reserve-permission!clj

(reserve-permission! limiter timeout-millis)
source

set-on-all-event-consumer!clj

(set-on-all-event-consumer! rate-limiter consumer-fn-map)
source

set-on-failed-acquire-event-consumer!clj

(set-on-failed-acquire-event-consumer! rate-limiter consumer-fn)
source

set-on-successful-acquire-event-consumer!clj

(set-on-successful-acquire-event-consumer! rate-limiter consumer-fn)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close