Concord - C Discord API library
A Discord API wrapper library written in C
Caching

Caching API supported by Concord. More...

Collaboration diagram for Caching:

Enumerations

enum  discord_cache_options { DISCORD_CACHE_MESSAGES = 1 << 0 , DISCORD_CACHE_GUILDS = 1 << 1 }
 

Functions

void discord_cache_enable (struct discord *client, enum discord_cache_options options)
 
const struct discord_messagediscord_cache_get_channel_message (struct discord *client, u64snowflake channel_id, u64snowflake message_id)
 Get a message from cache, only if locally available in RAM. More...
 
const struct discord_guilddiscord_cache_get_guild (struct discord *client, u64snowflake guild_id)
 Get a guild from cache, only if locally available in RAM. More...
 

Detailed Description

Caching API supported by Concord.

Enumeration Type Documentation

◆ discord_cache_options

Enumerator
DISCORD_CACHE_MESSAGES 
DISCORD_CACHE_GUILDS 

Function Documentation

◆ discord_cache_enable()

void discord_cache_enable ( struct discord client,
enum discord_cache_options  options 
)
Examples
cache.c.

◆ discord_cache_get_channel_message()

const struct discord_message * discord_cache_get_channel_message ( struct discord client,
u64snowflake  channel_id,
u64snowflake  message_id 
)

Get a message from cache, only if locally available in RAM.

Note
When done, discord_unclaim() must be called on the message resource
Parameters
clientthe client initialized with discord_init()
channel_idthe channel id the message is in
message_idthe id of the message
Returns
NULL if not found, or a cache'd message
Examples
cache.c.

◆ discord_cache_get_guild()

const struct discord_guild * discord_cache_get_guild ( struct discord client,
u64snowflake  guild_id 
)

Get a guild from cache, only if locally available in RAM.

Note
When done, discord_unclaim() must be called on the guild resource
Parameters
clientthe client initialized with discord_init()
guild_idthe id of the guild
Returns
NULL if not found, or a cache'd guild
Examples
cache.c.