title: Redis - Check if key exists using predis
body: <p>Using <code>predis</code> is it possible to check if a key exists?</p>
  
  <p>My <code>users</code> data is stored as follows:</p>
  
  <pre><code>public function createUser($email, $password, $username)
  {
      return $this-&gt;predis-&gt;hMset("user:{$username}", [
          'email' =&gt; $email,
          'password' =&gt; $password,
          'username' =&gt; $username
      ]);
  }
  </code></pre>
  
  <p>Now, when I check to see if a user exists I do the following:</p>
  
  <pre><code>public function checkUserExists($username)
  {
      return $this-&gt;predis-&gt;hExists("user:{$username}", 'username');
  }
  </code></pre>
  
  <p>Is it possible to check if the user exists without having to check if the key exists? For example by just checking <code>user:{$username}</code>?</p>