Package com.mewna.catnip.cache
Interface EntityCache
- All Known Subinterfaces:
EntityCacheWorker
- All Known Implementing Classes:
CustomizableEntityCache
,MemoryEntityCache
,NoopEntityCache
,SplitMemoryEntityCache
,UnifiedMemoryEntityCache
public interface EntityCache
If you're looking to implement your own caching system, you want
EntityCacheWorker
instead.- Since:
- 9/13/18.
- Author:
- amy
-
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Maybe<GuildChannel>
channel
(long guildId, long id) Get the channel with the given ID from the guild with the given ID.default io.reactivex.rxjava3.core.Maybe<GuildChannel>
Get the channel with the given ID from the guild with the given ID.channels()
Get all guild channels cached in this entity cache.channels
(long guildId) Get all channels for the guild with the given ID.default NamedCacheView<GuildChannel>
Get all channels for the guild with the given ID.io.reactivex.rxjava3.core.Maybe<Emoji.CustomEmoji>
emoji
(long guildId, long id) Get the custom emojis with the given ID from the guild with the given ID.default io.reactivex.rxjava3.core.Maybe<Emoji.CustomEmoji>
Get the custom emojis with the given ID from the guild with the given ID.emojis()
Get all emojis cached in this entity cache.emojis
(long guildId) Get all custom emojis for the guild with the given ID.default NamedCacheView<Emoji.CustomEmoji>
Get all custom emojis for the guild with the given ID.io.reactivex.rxjava3.core.Maybe<Guild>
guild
(long id) Get the guild with the specified ID.default io.reactivex.rxjava3.core.Maybe<Guild>
Get the guild with the specified ID.guilds()
io.reactivex.rxjava3.core.Maybe<Member>
member
(long guildId, long id) Get the member with the given ID from the guild with the given ID.default io.reactivex.rxjava3.core.Maybe<Member>
Get the member with the given ID from the guild with the given ID.members()
Get all members cached in this entity cache.members
(long guildId) Get all members for the guild with the given ID.default NamedCacheView<Member>
Get all members for the guild with the given ID.io.reactivex.rxjava3.core.Maybe<Presence>
presence
(long id) Get the presence for the user with the specified ID.default io.reactivex.rxjava3.core.Maybe<Presence>
Get the presence for the user with the specified ID.io.reactivex.rxjava3.core.Maybe<Role>
role
(long guildId, long id) Get the role with the given ID from the guild with the given ID.default io.reactivex.rxjava3.core.Maybe<Role>
Get the role with the given ID from the guild with the given ID.roles()
Get all roles cached in this entity cache.roles
(long guildId) Get all roles for the guild with the given ID.default NamedCacheView<Role>
Get all roles for the guild with the given ID.io.reactivex.rxjava3.core.Maybe<User>
selfUser()
io.reactivex.rxjava3.core.Maybe<ThreadChannel.ThreadMember>
threadMember
(long id) default io.reactivex.rxjava3.core.Maybe<ThreadChannel.ThreadMember>
threadMember
(String id) io.reactivex.rxjava3.core.Maybe<User>
user
(long id) Get the user with the specified ID.default io.reactivex.rxjava3.core.Maybe<User>
Get the user with the specified ID.users()
io.reactivex.rxjava3.core.Maybe<VoiceState>
voiceState
(long guildId, long id) Get the voice state for the user with the given ID, possibly in the guild with the given ID.default io.reactivex.rxjava3.core.Maybe<VoiceState>
voiceState
(String guildId, String id) Get the voice state for the user with the given ID, possibly in the guild with the given ID.Get all voice states for the entire bot.voiceStates
(long guildId) Get all voice states for the guild with the given ID.default CacheView<VoiceState>
voiceStates
(String guildId) Get all voice states for the guild with the given ID.
-
Method Details
-
guild
Get the guild with the specified ID. May benull
.- Parameters:
id
- The ID of the guild to fetch.- Returns:
- The guild, or
null
if it isn't cached.
-
guild
Get the guild with the specified ID. May benull
.- Parameters:
id
- The ID of the guild to fetch.- Returns:
- The guild, or
null
if it isn't cached.
-
guilds
- Returns:
- A view of the current guild cache. Updates to the cache will update this view.
-
user
Get the user with the specified ID. May benull
.- Parameters:
id
- The ID of the user to fetch.- Returns:
- The user, or
null
if it isn't cached.
-
user
Get the user with the specified ID. May benull
.- Parameters:
id
- The ID of the user to fetch.- Returns:
- The user, or
null
if it isn't cached.
-
users
- Returns:
- A view of the current user cache. Updates to the cache will update this view.
-
presence
Get the presence for the user with the specified ID. May benull
.- Parameters:
id
- The ID of the user whose presence is to be fetched.- Returns:
- The user's presence, or
null
if it isn't cached.
-
presence
Get the presence for the user with the specified ID. May benull
.- Parameters:
id
- The ID of the user whose presence is to be fetched.- Returns:
- The user's presence, or
null
if it isn't cached.
-
presences
- Returns:
- A view of the current presence cache. Updates to the cache will update this view.
-
member
@Nonnull default io.reactivex.rxjava3.core.Maybe<Member> member(@Nonnull String guildId, @Nonnull String id) Get the member with the given ID from the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the desired member is in.id
- The ID of the desired member.- Returns:
- The member, or
null
if it isn't cached.
-
member
Get the member with the given ID from the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the desired member is in.id
- The ID of the desired member.- Returns:
- The member, or
null
if it isn't cached.
-
members
Get all members for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch members for.- Returns:
- A view of the current member cache of the guild. Updates to the cache will update this view.
-
members
Get all members for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch members for.- Returns:
- A view of the current member cache of the guild. Updates to the cache will update this view.
-
members
Get all members cached in this entity cache.- Returns:
- A view of all the current member caches. Updates to the caches or additions/removals (of guilds) will update this view.
-
role
@Nonnull default io.reactivex.rxjava3.core.Maybe<Role> role(@Nonnull String guildId, @Nonnull String id) Get the role with the given ID from the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the desired role is from.id
- The ID of the desired role.- Returns:
- The role, or
null
if it isn't cached.
-
role
Get the role with the given ID from the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the desired role is from.id
- The ID of the desired role.- Returns:
- The role, or
null
if it isn't cached.
-
roles
Get all roles for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch roles for.- Returns:
- A view of the current role cache of the guild. Updates to the cache will update this view.
-
roles
Get all roles for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch roles for.- Returns:
- A view of the current role cache of the guild. Updates to the cache will update this view.
-
roles
Get all roles cached in this entity cache.- Returns:
- A view of all the current role caches. Updates to the caches or additions/removals (of guilds) will update this view.
-
channel
@Nonnull default io.reactivex.rxjava3.core.Maybe<GuildChannel> channel(@Nonnull String guildId, @Nonnull String id) Get the channel with the given ID from the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the desired channel is from.id
- The ID of the desired channel.- Returns:
- The channel, or
null
if it isn't cached.
-
channel
Get the channel with the given ID from the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the desired channel is from.id
- The ID of the desired channel.- Returns:
- The channel, or
null
if it isn't cached.
-
channels
Get all channels for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch channels for.- Returns:
- A view of the current channel cache of the guild. Updates to the cache will update this view.
-
channels
Get all channels for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch channels for.- Returns:
- A view of the current channel cache of the guild. Updates to the cache will update this view.
-
channels
Get all guild channels cached in this entity cache.- Returns:
- A view of all the current guild channel caches. Updates to the caches or additions/removals (of guilds) will update this view.
-
threadMember
@Nonnull default io.reactivex.rxjava3.core.Maybe<ThreadChannel.ThreadMember> threadMember(@Nonnull String id) -
threadMember
-
threadMembers
-
emoji
@Nonnull default io.reactivex.rxjava3.core.Maybe<Emoji.CustomEmoji> emoji(@Nonnull String guildId, @Nonnull String id) Get the custom emojis with the given ID from the guild with the given ID. May benull
,- Parameters:
guildId
- The ID of the guild the desired custom emojis is from.id
- The ID of the desired custom emojis.- Returns:
- The custom emojis, or
null
if it isn't cached.
-
emoji
Get the custom emojis with the given ID from the guild with the given ID. May benull
,- Parameters:
guildId
- The ID of the guild the desired custom emojis is from.id
- The ID of the desired custom emojis.- Returns:
- The custom emojis, or
null
if it isn't cached.
-
emojis
Get all custom emojis for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch custom emojis for.- Returns:
- A view of the current emoji cache of the guild. Updates to the cache will update this view.
-
emojis
Get all custom emojis for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch custom emojis for.- Returns:
- A view of the current emoji cache of the guild. Updates to the cache will update this view.
-
emojis
Get all emojis cached in this entity cache.- Returns:
- A view of all the current emoji caches. Updates to the caches or additions/removals (of guilds) will update this view.
-
voiceState
@Nonnull default io.reactivex.rxjava3.core.Maybe<VoiceState> voiceState(@Nonnull String guildId, @Nonnull String id) Get the voice state for the user with the given ID, possibly in the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the voice state is from. May not benull
id
- The ID of the user whose voice state is desired. May not benull
.- Returns:
- The requested voice state, or
null
if it isn't cached.
-
voiceState
Get the voice state for the user with the given ID, possibly in the guild with the given ID. May benull
.- Parameters:
guildId
- The ID of the guild the voice state is from.id
- The ID of the user whose voice state is desired.- Returns:
- The requested voice state, or
null
if it isn't cached.
-
voiceStates
Get all voice states for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch voice states for.- Returns:
- A view of the current voice state cache of the guild. Updates to the cache will update this view.
-
voiceStates
Get all voice states for the guild with the given ID.- Parameters:
guildId
- The ID of the guild to fetch voice states for.- Returns:
- A view of the current voice state cache of the guild. Updates to the cache will update this view.
-
voiceStates
Get all voice states for the entire bot.- Returns:
- A view of all the current voice state caches. Updates to the caches or additions/removals (of guilds) will update this view.
-
selfUser
- Returns:
- The currently-logged-in user. May be
null
if no shards have logged in.
-