function useNonce($server_url, $timestamp, $salt)
{
global $Auth_OpenID_SKEW;
// save one request to memcache when nonce obviously expired
if (abs($timestamp - time()) > $Auth_OpenID_SKEW) {
return false;
}
// SETNX will set the value only of the key doesn't exist yet.
$nonceKey = $this->nonceKey($server_url, $salt);
$added = $this->redis->setnx($nonceKey, "1");
if ($added) {
// Will set expiration
$this->redis->expire($nonceKey, $Auth_OpenID_SKEW);
return true;
} else {
return false;
}
}