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 zhash value type #13

Closed
vrongmeal opened this issue Aug 28, 2020 · 6 comments
Closed

Add zhash value type #13

vrongmeal opened this issue Aug 28, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@vrongmeal
Copy link
Contributor

It would be great to have a "zhash" in standard set of values. This would be similar to zset (or scored set) with the difference that a zhash will have a value along with the score.

A zset can be thought of as:

Key Score
key_one 10
key_two 20
key_three 30

whereas a zhash will be:

Key Score Value
key_one 10 val_one
key_two 20 val_two
key_three 30 val_three

For documentation on how to add a new value type, see: https://kiwi.sdslabs.co/docs/add-new-value-type.html

@vrongmeal vrongmeal added the enhancement New feature or request label Aug 28, 2020
@carmo-evan
Copy link
Contributor

I'd like to take a stab at this, if that's ok.

@vrongmeal
Copy link
Contributor Author

I'd like to take a stab at this, if that's ok.

@carmo-evan Go ahead. That would be awesome!

@carmo-evan
Copy link
Contributor

@vrongmeal Hi! Sorry, I just had a chance to look into it yesterday.

From what I can gather, zhash will be very similar to zset, and we can probably use the same underlying sortedSet value.

What would you like the API to be like? Do you want to be able to insert the value together with they key in the INSERT method, or do you want to do it in two steps - insert the key, and then update to set the value and the score?

Thank you!

@vrongmeal
Copy link
Contributor Author

When inserting, you can do both the things. Parameters are dynamic. So if you get one parameter you can just insert it, if you get two, you can insert while setting the value. There will always be a "SET" action if someone wants to insert the key and then set the value.

@carmo-evan
Copy link
Contributor

PR is up here #17

@vrongmeal
Copy link
Contributor Author

Closed through #17

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

No branches or pull requests

2 participants