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 Details

    • guild

      @Nonnull default io.reactivex.rxjava3.core.Maybe<Guild> guild(@Nonnull String id)
      Get the guild with the specified ID. May be null.
      Parameters:
      id - The ID of the guild to fetch.
      Returns:
      The guild, or null if it isn't cached.
    • guild

      @Nonnull io.reactivex.rxjava3.core.Maybe<Guild> guild(long id)
      Get the guild with the specified ID. May be null.
      Parameters:
      id - The ID of the guild to fetch.
      Returns:
      The guild, or null if it isn't cached.
    • guilds

      @Nonnull NamedCacheView<Guild> guilds()
      Returns:
      A view of the current guild cache. Updates to the cache will update this view.
    • user

      @Nonnull default io.reactivex.rxjava3.core.Maybe<User> user(@Nonnull String id)
      Get the user with the specified ID. May be null.
      Parameters:
      id - The ID of the user to fetch.
      Returns:
      The user, or null if it isn't cached.
    • user

      @Nonnull io.reactivex.rxjava3.core.Maybe<User> user(long id)
      Get the user with the specified ID. May be null.
      Parameters:
      id - The ID of the user to fetch.
      Returns:
      The user, or null if it isn't cached.
    • users

      @Nonnull NamedCacheView<User> users()
      Returns:
      A view of the current user cache. Updates to the cache will update this view.
    • presence

      @Nonnull default io.reactivex.rxjava3.core.Maybe<Presence> presence(@Nonnull String id)
      Get the presence for the user with the specified ID. May be null.
      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

      @Nonnull io.reactivex.rxjava3.core.Maybe<Presence> presence(long id)
      Get the presence for the user with the specified ID. May be null.
      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

      @Nonnull CacheView<Presence> 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 be null.
      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

      @Nonnull 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. May be null.
      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

      @Nonnull default NamedCacheView<Member> members(@Nonnull String guildId)
      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

      @Nonnull NamedCacheView<Member> members(long guildId)
      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

      @Nonnull NamedCacheView<Member> 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 be null.
      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

      @Nonnull 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. May be null.
      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

      @Nonnull default NamedCacheView<Role> roles(@Nonnull String guildId)
      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

      @Nonnull NamedCacheView<Role> roles(long guildId)
      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

      @Nonnull NamedCacheView<Role> 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 be null.
      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

      @Nonnull io.reactivex.rxjava3.core.Maybe<GuildChannel> channel(long guildId, long id)
      Get the channel with the given ID from the guild with the given ID. May be null.
      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

      @Nonnull default NamedCacheView<GuildChannel> channels(@Nonnull String guildId)
      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

      @Nonnull NamedCacheView<GuildChannel> channels(long guildId)
      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

      @Nonnull NamedCacheView<GuildChannel> 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

      @Nonnull io.reactivex.rxjava3.core.Maybe<ThreadChannel.ThreadMember> threadMember(long id)
    • threadMembers

      @Nonnull CacheView<ThreadChannel.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 be null,
      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

      @Nonnull 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. May be null,
      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

      @Nonnull default NamedCacheView<Emoji.CustomEmoji> emojis(@Nonnull String guildId)
      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

      @Nonnull NamedCacheView<Emoji.CustomEmoji> emojis(long guildId)
      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

      @Nonnull NamedCacheView<Emoji.CustomEmoji> 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 be null.
      Parameters:
      guildId - The ID of the guild the voice state is from. May not be null
      id - The ID of the user whose voice state is desired. May not be null.
      Returns:
      The requested voice state, or null if it isn't cached.
    • voiceState

      @Nonnull 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. May be null.
      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

      @Nonnull default CacheView<VoiceState> voiceStates(@Nonnull String guildId)
      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

      @Nonnull CacheView<VoiceState> voiceStates(long guildId)
      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

      @Nonnull CacheView<VoiceState> 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

      @Nonnull io.reactivex.rxjava3.core.Maybe<User> selfUser()
      Returns:
      The currently-logged-in user. May be null if no shards have logged in.