title: redis keep expireAt, would it guarantee to be expired?
body: <p>I want to use a key to limit request count per second（RPS），I want the key to be expired every seconds, so it would like:</p>
  
  <pre><code>if($redis-&gt;get($key) &gt; 10){
      // reject
  }else{
      $redis-&gt;incr($key);
      $redis-&gt;expire($key, 1);  // one second later would be a new key
      // accept
  }
  </code></pre>
  
  <p>This would cause problem, because every requests wound refresh the expire, so the key would never expired.</p>
  
  <p>So if I change it to:</p>
  
  <pre><code>$redis-&gt;expireAt($key, time() + 1);  // absolute time, expired at the beginning of next second
  </code></pre>
  
  <p>I don't know if this would do the trick.</p>
  
  <p>Will the key guarantee to expired at that time? Or may be if the request happens exactly at the beginning of next second,it would be refreshed too?</p>
  
  <p>PS：Offical Docs used if check and expire in a script, but I just want to know  if expireAt without script would do. Thks.</p>
  
  <h2>EDIT</h2>
  
  <p>I'll try to make an example.</p>
  
  <p>Now it's 23:50:51，each request in this second will issue expireAt 23:50:52，so if it's accurate, the key would expire at that time, when the time comes at 23:50:52, the request would make expireAt 23:50:53, but in theory the key should be just expired, so it's still a new key, which do the trick without multi-keys or script</p>