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

Add hashmap to redis args #722

Merged
merged 4 commits into from
Dec 11, 2022

Conversation

gibranamparan
Copy link
Contributor

@gibranamparan gibranamparan commented Nov 16, 2022

This is adding the std::collections::HashMap as a ToRedisArgs so that now would be possible to run HSET commands using a simple HashMap (as it already supports for BTreeMap)

Fixes #444.

@gibranamparan gibranamparan changed the title add_hashmap_to_redis_args Add hashmap to redis args Nov 16, 2022
@shachlanAmazon
Copy link

Can we allocate capacity ahead of time? in large maps this might have significant perf cost.

https://morestina.net/blog/1843/the-stable-hashmap-trap

Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

Seems reasonable. @jaymell any thoughts?

@djc
Copy link
Contributor

djc commented Nov 20, 2022

Can we allocate capacity ahead of time? in large maps this might have significant perf cost.

https://morestina.net/blog/1843/the-stable-hashmap-trap

This is only a ToRedisArgs impl, writing out the HashMaps items into Redis args. Seems to me that the capacity issue you're referring to would only be relevant for a FromRedisValue impl.

@shachlanAmazon
Copy link

Can we allocate capacity ahead of time? in large maps this might have significant perf cost.
https://morestina.net/blog/1843/the-stable-hashmap-trap

This is only a ToRedisArgs impl, writing out the HashMaps items into Redis args. Seems to me that the capacity issue you're referring to would only be relevant for a FromRedisValue impl.

Oy, you're right 😵‍💫

@jaymell
Copy link
Contributor

jaymell commented Nov 23, 2022

The PR does not compile....

@gibranamparan
Copy link
Contributor Author

gibranamparan commented Dec 8, 2022

The PR does not compile....

This should compile now.

@jaymell jaymell merged commit 82eeb45 into redis-rs:main Dec 11, 2022
@jaymell
Copy link
Contributor

jaymell commented Dec 11, 2022

Thanks!

nonirosenfeldredis pushed a commit to nonirosenfeldredis/redis-rs that referenced this pull request Feb 13, 2023
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.

HashMap doesn't implement ToRedisArgs
4 participants