Using predis
is it possible to check if a key exists?
My users
data is stored as follows:
public function createUser($email, $password, $username)
{
return $this->predis->hMset("user:{$username}", [
'email' => $email,
'password' => $password,
'username' => $username
]);
}
Now, when I check to see if a user exists I do the following:
public function checkUserExists($username)
{
return $this->predis->hExists("user:{$username}", 'username');
}
Is it possible to check if the user exists without having to check if the key exists? For example by just checking user:{$username}
?
key
exists and not thevalue
. You can't check forvalue
without akey
– Woehick