pub async fn delete_user_and_invalidate_cached_tokens(
conn: &mut PgConnection,
cache: &Cache,
token_hmac_key: &SecretString,
user_id: Uuid,
) -> Result<(), ModelError>Expand description
Soft-deletes a user and evicts every cached mapping their access tokens had.
The only supported way to delete a user: models::users::delete_user returns the digests of the
tokens it hard-deleted, and a caller that drops them leaves a banned account authenticating from
a cache hit for the rest of MAX_CACHE_TTL. Both callers — self-service account deletion and the
sync_tmc_users batch — go through here so neither can forget.