quic_token_cache (quic v1.3.1)

View Source

Summary

Functions

Drop all cached tokens. Useful for tests.

Store a token for the given endpoint. Overwrites any previous entry for the same endpoint; when the cache is at its size limit, the oldest entry is dropped.

Atomically return and remove a cached token for the endpoint, or empty if none is cached. Returning the token consumes it — per RFC 9000 §8.1.3 each NEW_TOKEN is meant to be used at most once.

Types

endpoint/0

-type endpoint() :: {binary() | inet:ip_address(), inet:port_number()}.

Functions

clear()

-spec clear() -> ok.

Drop all cached tokens. Useful for tests.

handle_call(_, From, Tab)

handle_cast(_, Tab)

init(_)

put(Endpoint, Token)

-spec put(endpoint(), binary()) -> ok.

Store a token for the given endpoint. Overwrites any previous entry for the same endpoint; when the cache is at its size limit, the oldest entry is dropped.

start_link()

-spec start_link() -> {ok, pid()}.

take(Endpoint)

-spec take(endpoint()) -> {ok, binary()} | empty.

Atomically return and remove a cached token for the endpoint, or empty if none is cached. Returning the token consumes it — per RFC 9000 §8.1.3 each NEW_TOKEN is meant to be used at most once.