Redis issue with unique key

248 views Asked by At

Im fairly new to redis and new to hex.

As i understand, i need an unique key,then i can add multiple fields in it.

im going to save alot of user information using hget and hset.

I was planning to use it something like

"user useridHere: password $password"

ETC if you are see. for example

user 1: password pass123

and to get the password

hget("user 1: password");

But because i cant serach user information without the userid, because redis is depending on the key, i dont know how i should proceed.

My user is going to login with their username and password and i need to search for a match.

as i dont want to do user stackoverflow: password, i need to find another way, because the username is changeable.

How should i save my accounts in redis and search in them for their username and password for match?

1

There are 1 answers

1
JasonJensenDev On

If I were you, I would store the username in Redis, and then if they ever change their username, simply remove that username entry and create a new one.