Skip to main content

spawn_purge

Function spawn_purge 

Source
pub fn spawn_purge(
    registry: AuthProxyRegistry,
    interval: Duration,
) -> JoinHandle<()> ⓘ
Expand description

Spawn a task dropping the expired grants of registry every interval.

Abort the returned handle to stop it.

§Panics

Panics if interval is zero, or when called outside a Tokio runtime.

§Examples

use std::time::Duration;

use ironflow_auth_proxy::spawn_purge;
use ironflow_core::auth_proxy::AuthProxyRegistry;

let purge = spawn_purge(AuthProxyRegistry::default(), Duration::from_secs(60));
purge.abort();