Skip to content

Commit

Permalink
Merge pull request #555 from Kraigie/jb3/nuke-channel-cache
Browse files Browse the repository at this point in the history
Nuke the ChannelCache from existence
  • Loading branch information
jb3 authored Apr 19, 2024
2 parents a72d725 + e6e1b07 commit 984e052
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 574 deletions.
5 changes: 1 addition & 4 deletions examples/cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defmodule ExampleCommands do
import Nostrum.Snowflake, only: [is_snowflake: 1]

alias Nostrum.Api
alias Nostrum.Cache.{ChannelCache, GuildCache, UserCache}
alias Nostrum.Cache.{GuildCache, UserCache}
alias Nostrum.Struct.User

# Fetch the defined prefix from our config, however,
Expand Down Expand Up @@ -66,15 +66,12 @@ defmodule ExampleCommands do
{Integer.parse(message_user_id), :parse_id},
{:ok, user} <-
get_cached_with_fallback(user_id, &UserCache.get/1, &Api.get_user/1),
{:ok, %{name: channel_name}} <-
get_cached_with_fallback(channel_id, &ChannelCache.get/1, &Api.get_channel/1),
{:ok, %{name: guild_name}} <-
get_cached_with_fallback(guild_id, &GuildCache.get/1, &Api.get_guild/1) do
Api.create_message(
channel_id,
"""
ID #{message_user_id} belongs to: #{User.full_name(user)}
Message sent in channel: ##{channel_name}
Channel belongs to guild: #{guild_name}
"""
)
Expand Down
3 changes: 1 addition & 2 deletions lib/nostrum/cache/cache_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ defmodule Nostrum.Cache.CacheSupervisor do
See the documentation for the relevant submodules for details:
- `Nostrum.Cache.ChannelCache`
- `Nostrum.Cache.GuildCache`
- `Nostrum.Cache.Me`
- `Nostrum.Cache.MemberCache`
- `Nostrum.Cache.PresenceCache`
- `Nostrum.Cache.UserCache`
"""
Expand All @@ -25,7 +25,6 @@ defmodule Nostrum.Cache.CacheSupervisor do
Nostrum.Cache.GuildCache,
Nostrum.Cache.MemberCache,
Nostrum.Cache.UserCache,
Nostrum.Cache.ChannelCache,
Nostrum.Cache.PresenceCache
]

Expand Down
177 changes: 0 additions & 177 deletions lib/nostrum/cache/channel_cache.ex

This file was deleted.

91 changes: 0 additions & 91 deletions lib/nostrum/cache/channel_cache/ets.ex

This file was deleted.

Loading

0 comments on commit 984e052

Please sign in to comment.