Package com.mewna.catnip.cache
Class SplitMemoryEntityCache
java.lang.Object
com.mewna.catnip.cache.MemoryEntityCache
com.mewna.catnip.cache.SplitMemoryEntityCache
- All Implemented Interfaces:
EntityCache
,EntityCacheWorker
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mewna.catnip.cache.EntityCacheWorker
EntityCacheWorker.CachedEntityState
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<Integer,
MutableCacheView<UserDMChannel>> protected final Map<Integer,
MutableCacheView<Presence>> protected final Map<Integer,
MutableNamedCacheView<User>> Fields inherited from class com.mewna.catnip.cache.MemoryEntityCache
emojiCache, guildCache, guildChannelCache, memberCache, roleCache, selfUser, threadMemberCache, voiceStateCache
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected MutableCacheView<UserDMChannel>
dmChannelCache
(int shardId) void
invalidateShard
(int id) io.reactivex.rxjava3.core.Maybe<Presence>
presence
(long id) Get the presence for the user with the specified ID.protected MutableCacheView<Presence>
presenceCache
(int shardId) io.reactivex.rxjava3.core.Maybe<User>
user
(long id) Get the user with the specified ID.protected MutableNamedCacheView<User>
userCache
(int shardId) users()
Methods inherited from class com.mewna.catnip.cache.MemoryEntityCache
bulkCacheChannels, bulkCacheEmoji, bulkCacheMembers, bulkCachePresences, bulkCacheRoles, bulkCacheThreadMembers, bulkCacheUsers, bulkCacheVoiceStates, canProvidePreviousState, catnip, catnip, channel, channelCache, channels, channels, createCacheView, createDMChannelCacheView, createEmojiCacheView, createGuildCacheView, createGuildChannelCacheView, createMemberCacheView, createNamedCacheView, createPresenceCacheView, createRoleCacheView, createUserCacheView, createVoiceStateCacheView, deleteChannelCache, deleteEmojiCache, deleteMemberCache, deleteRoleCache, deleteThreadCache, deleteVoiceStateCache, emoji, emojiCache, emojis, emojis, guild, guildCache, guilds, member, memberCache, memberNameFunction, members, members, or, or, role, roleCache, roles, roles, selfUser, shardId, threadMember, threadMembers, updateCache, voiceState, voiceStateCache, voiceStates, voiceStates
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mewna.catnip.cache.EntityCache
channel, channels, emoji, emojis, guild, member, members, presence, role, roles, threadMember, user, voiceState, voiceStates
-
Field Details
-
userCache
-
presenceCache
-
dmChannelCache
-
-
Constructor Details
-
SplitMemoryEntityCache
public SplitMemoryEntityCache()
-
-
Method Details
-
invalidateShard
public void invalidateShard(int id) - Specified by:
invalidateShard
in interfaceEntityCacheWorker
- Overrides:
invalidateShard
in classMemoryEntityCache
-
userCache
- Specified by:
userCache
in classMemoryEntityCache
-
dmChannelCache
- Specified by:
dmChannelCache
in classMemoryEntityCache
-
presenceCache
- Specified by:
presenceCache
in classMemoryEntityCache
-
user
Description copied from interface:EntityCache
Get the user with the specified ID. May benull
.- Specified by:
user
in interfaceEntityCache
- Overrides:
user
in classMemoryEntityCache
- 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
Description copied from interface:EntityCache
Get the presence for the user with the specified ID. May benull
.- Specified by:
presence
in interfaceEntityCache
- Overrides:
presence
in classMemoryEntityCache
- 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.
-