Skip to main content

shared

Function shared 

Source
pub fn shared(throttle: ThrottleRequests) -> MiddlewareStack
Expand description

Count throttle in the application’s shared store.

Returns a stack rather than a middleware because the store is resolved from the container, and routes are declared before there is one — the same reason Authenticate::resolved exists.

Without this a throttle counts in its own process. With it, every limiter in the application counts in one place and a deployment moves them all at once by changing CACHE_DRIVER.