gaato/discord/cache does not have a README file

CacheLimit

pub struct CacheLimit {
// private fields
}

Bounds one cached resource by entry count, lifetime, or both.

Negative limits clamp to zero. A max_entries of zero retains nothing, while a ttl_ms of zero makes entries expire immediately. TTL deadlines are fixed when an entry is written and are never extended by reads; expiry is enforced lazily without background timers.

CacheLimit::CacheLimit

fn CacheLimit::CacheLimit(max_entries? : Int, ttl_ms? : Int64) -> CacheLimit

Create an optional entry-count and TTL limit for one resource.

CacheLimits

pub struct CacheLimits {
// private fields
}

Per-resource bounds for an in-memory cache.

Guild, channel, and user limits are global. Role, member, voice-state, and presence limits apply independently per guild; message limits apply independently per channel. The unavailable-guild flags and the channel-to-guild index are small bookkeeping state and remain unbounded. TTLs use fixed, non-sliding deadlines set at write time and are enforced lazily without background timers.

CacheLimits::CacheLimits

fn CacheLimits::CacheLimits(guilds? : CacheLimit, channels? : CacheLimit, users? : CacheLimit, roles? : CacheLimit, members? : CacheLimit, voice_states? : CacheLimit, presences? : CacheLimit, messages? : CacheLimit) -> CacheLimits

Configure limits for each resource. Messages retain at most 100 entries per channel by default; other resources are unbounded by default.

CacheLimits::default

fn CacheLimits::default() -> CacheLimits

The default per-resource limits (see CacheLimits).

CacheResources

pub struct CacheResources {
// private fields
}

Selects which gateway resources an in-memory cache retains.

Guilds, channels, roles, members, users, and voice states are enabled by default. Presences and messages are opt-in because they are high-churn and can dominate memory use on larger bots.

CacheResources::CacheResources

fn CacheResources::CacheResources(guilds? : Bool, channels? : Bool, roles? : Bool, members? : Bool, users? : Bool, voice_states? : Bool, presences? : Bool, messages? : Bool) -> CacheResources

Select the retained resources individually; unspecified flags keep their defaults (all on except presences and messages).

CacheResources::all

Retain every resource, including high-churn presences and messages.

CacheResources::default

The default selection (see CacheResources).

CacheResources::none

Retain nothing; enable resources from this baseline for a minimal cache.

InMemoryCache

pub struct InMemoryCache {
// private fields
}

A gateway-driven, resource-selective in-memory cache.

update is the only mutation entry point. Entity getters return the model value retained by the cache; callers should treat it as immutable. List getters always allocate a new outer array so callers cannot mutate the cache's collections.

InMemoryCache::InMemoryCache

fn InMemoryCache::InMemoryCache(resources~ : CacheResources, limits? : CacheLimits, now? : () -> Int64) -> InMemoryCache

Create an empty cache retaining the selected resources under the per-resource limits. Feed it gateway events via Bot::attach_cache (or call update manually). TTL deadlines are fixed at write time and expiry is enforced lazily without background timers.

InMemoryCache::channel

The cached channel or thread, if retained.

InMemoryCache::channels

All cached channels and threads.

InMemoryCache::guilds

All cached guilds.

InMemoryCache::is_guild_unavailable

Whether the guild is currently marked unavailable by a GUILD_DELETE outage notice.

InMemoryCache::members

All cached members of a guild (only members seen in events unless the privileged GUILD_MEMBERS intent fills the cache).

InMemoryCache::messages

Cached messages of a channel, oldest first, capped by the messages limit.

InMemoryCache::permissions

Computes guild-level permissions from the cached guild, member, and roles.

InMemoryCache::permissions_in

Computes channel permissions using the cached base resources and channel overwrites. Returns None when any required cache resource is disabled or absent.

InMemoryCache::unavailable_guilds

Ids of guilds currently marked unavailable.

InMemoryCache::update

fn InMemoryCache::update(self : InMemoryCache, event :
Event
) -> Unit

Applies one decoded gateway event. Unsupported events are intentionally ignored for forward compatibility.

InMemoryCache::users

All cached users.

InMemoryCache::voice_state

The cached voice state of a user in a guild, if any.

InMemoryCache::voice_states

All cached voice states of a guild.

Source Files