Skip to main content

Module profile_me_cache

Module profile_me_cache 

Source
Expand description

In-memory cache for the GET /api/me content-derived ETag.

/api/me is polled frequently by federation followers doing conditional refreshes. Each request would otherwise hit the auth + meta adapters and re-serialize the same ProfileBase. This cache holds only the content-derived ETag keyed on TnId so a warm conditional poll can answer 304 Not Modified without a meta-adapter read. The body is cheap to rebuild and is regenerated on every 200, so it is not cached.

The ETag is a content-derived, truncated SHA-256 digest of the serialized ProfileBase — see get_tenant_profile_base. SHA-256 has a fixed, specified output, so it is stable for unchanged content across Rust versions and restarts and a follower’s If-None-Match keeps matching even across cache rebuilds. The short TTL is only a staleness backstop; explicit invalidate calls on profile/key writes are the real freshness mechanism.

Modeled directly on proxy_token_cache::ProxyTokenCache (lru::LruCache + parking_lot::Mutex, Timestamp-based TTL).

Structs§

ProfileMeCache
LRU-bounded cache of /api/me responses keyed on TnId.