Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Cache methods returning mapped references #2794

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

GnomedDev
Copy link
Member

These mapped references confuse beginners to the simplicity of the cache, and can lead to performance hits for users who accidentally fetch guilds multiple times in one function. It also leads to extra caching when absolutely optional, such as the Cache::channels cache which simply stores ChannelId: GuildId for the methods which need a GuildId but don't take it. This PR deprecates the methods and removes the usage when possible, and if not deprecates the methods it was used on.

I have had to remove some of the preemptive error checks or move them to the model versions instead of the ID versions, but I don't exactly like these preemptive checks anyway.

@github-actions github-actions bot added model Related to the `model` module. client Related to the `client` module. builder Related to the `builder` module. cache Related to the `cache`-feature. utils Related to the `utils` module. labels Mar 12, 2024
@github-actions github-actions bot added the framework Related to the `framework` and `framework::standard` modules and/or the `command_attr` crate label Mar 12, 2024
@GnomedDev GnomedDev force-pushed the deprecate-cache-mapped-ref branch 2 times, most recently from ff51827 to 4ee8e15 Compare March 12, 2024 23:26
@GnomedDev GnomedDev force-pushed the deprecate-cache-mapped-ref branch 2 times, most recently from 9c0e50e to d4efb09 Compare March 12, 2024 23:56
@arqunis arqunis added the enhancement An improvement to Serenity. label Mar 13, 2024
@GnomedDev GnomedDev merged commit 5a4d30d into serenity-rs:current Mar 13, 2024
22 checks passed
@GnomedDev GnomedDev deleted the deprecate-cache-mapped-ref branch March 13, 2024 11:06
arqunis pushed a commit that referenced this pull request Mar 16, 2024
This was mistakenly removed in #2794 but is still possible here as we
have the `GuildId`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builder Related to the `builder` module. cache Related to the `cache`-feature. client Related to the `client` module. enhancement An improvement to Serenity. framework Related to the `framework` and `framework::standard` modules and/or the `command_attr` crate model Related to the `model` module. utils Related to the `utils` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants