Skip to main content

channel_cache

Function channel_cache 

Source
fn channel_cache<K, V>(name: &str) -> Cache<K, V>
where K: Hash + Eq + Send + Sync + 'static, V: Clone + Send + Sync + 'static,
Expand description

Builds a cache with the shared tuning for both channel caches: 500 entries, TTL 1 hour, TTI 1 hour.

The time-to-live is not just a memory bound: a cached GuildChannel carries the permission overwrites that decide whether a link may be expanded, so a stale entry keeps authorizing against permissions that no longer exist. invalidate_channel drops entries as soon as Discord reports a change, and this bounds how long a change that never reached us — a missed event across a gateway session it could not resume — can stay in effect.