I want to save my users information in hashes. I want to create a hash for each user in the application.
The hashes name is like this: "user:1001"
Now, i want to users id start from 1000 and increase by one.
how can i do this?
thanks
You can have a key called user:id
, which will be a number that you will increment to obtain new ids. In your case, you can set the initial value to 1000:
SET user:id 1000
Then by using INCR
you will be able to get a new id for your next user:
INCR user:id
Depending on the language you use, there may be already some tools to solve this problem. I would recommend you check Ohm, or one of the ports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With