Skip to content

feat: update cache to use structured keys #27

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

haardikk21
Copy link
Contributor

Our cache previously used raw String types everywhere for the keys. This was messy, error-prone, and also a bit more memory-heavy.

This PR introduces a CacheKey enum that includes variants for all currently used keys in a structured type-safe manner. It can be extended easily later if new key types need to be added. It also implements the Display trait for the keys so they can be logged if necessary similar to the previous format.

Copy link
Collaborator

@danyalprout danyalprout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks -- as a follow up I wonder if we could structure the in-memory store in a way that we don't need all the casts?

Maybe we should have a cache per type or something?

@danyalprout danyalprout merged commit 18c8dd2 into base:main May 13, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants