ExMCP.Internal.ConsentCache (ex_mcp v0.9.2)
View SourceA GenServer and ETS-based cache for user consent decisions.
Summary
Functions
Checks for an existing, valid consent in the cache.
Returns a specification to start this module under a supervisor.
Triggers a manual cleanup of expired consent entries.
Clears all consent decisions from the cache.
Revokes a consent decision from the cache.
Starts the ConsentCache GenServer.
Stores a consent decision in the cache.
Functions
@spec check_consent( ExMCP.ConsentHandler.user_id(), ExMCP.ConsentHandler.resource_origin() ) :: {:ok, expires_at :: non_neg_integer()} | {:not_found} | {:expired}
Checks for an existing, valid consent in the cache.
This performs a direct ETS lookup for performance.
Returns a specification to start this module under a supervisor.
See Supervisor.
Triggers a manual cleanup of expired consent entries.
Clears all consent decisions from the cache.
This is primarily intended for testing purposes to ensure test isolation.
@spec revoke_consent( ExMCP.ConsentHandler.user_id(), ExMCP.ConsentHandler.resource_origin() ) :: :ok
Revokes a consent decision from the cache.
Starts the ConsentCache GenServer.
@spec store_consent( ExMCP.ConsentHandler.user_id(), ExMCP.ConsentHandler.resource_origin(), expires_at :: non_neg_integer() ) :: :ok
Stores a consent decision in the cache.
expires_at is a monotonic time in seconds.