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

Cache values should be anything that can de (de)serialized #1208

Open
georgeboot opened this issue Jan 22, 2025 · 2 comments · May be fixed by #1217
Open

Cache values should be anything that can de (de)serialized #1208

georgeboot opened this issue Jan 22, 2025 · 2 comments · May be fixed by #1217
Labels
enhancement New feature or request

Comments

@georgeboot
Copy link
Contributor

Currently, the cache values are always strings. However, it should be relatively easy to store anything that can be serialized.

I am willing to contribute this change, but am announcing my intention so that I can collect additional suggestions.

@georgeboot georgeboot added the enhancement New feature or request label Jan 22, 2025
@jondot
Copy link
Contributor

jondot commented Jan 24, 2025

Hi @georgeboot yes, String is used for its universal properties across cache providers, across languages. However, as you mention, it is entirely possible that serde_json::Value may be something that can replace it.
We used a String to get to the same simplicity such as when Redis used Strings.

Im curious, what are your thoughts? do you want to use serde_json::Value? if so what are the pros/cons?

@georgeboot
Copy link
Contributor Author

I think string-only was a good frist step, but there are plenty use cases to support other types as well. For example, in our auth pipeline, we want to store a simpel boolean flag (outcome of a complex auth process). Now I have to manually encode en decode the boolean to and from some string format (serde_json in our case).

serde_json has the benefit that it's widely known and human readable. Downsides are that it's not the most efficient out there. We should also consider something like MessagePack.

The question is, do we expect our users to interact with redis directly and do we expect them to be able to parse it contents? If yes, lets go serde_json. If no, let's go MessagePack (via rmp-serde)

@georgeboot georgeboot linked a pull request Jan 24, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants