Example #1
0
 /**
  * Set the string value in argument as value of the key, with a time to live in seconds.
  *
  * @param string $key
  * @param int $ttl
  * @param string $value
  *
  * @return bool: TRUE if the command is successful.
  * @link http://redis.io/commands/setex
  * @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
  */
 public function setEx($key, $ttl, $value)
 {
     try {
         return $this->client->setEx($key, $ttl, $value);
     } catch (Exception $e) {
         return $this->handleException($e, __FUNCTION__, func_get_args());
     }
 }
Example #2
0
 /**
  * Set the string value in argument as value of the key, with a time to live in seconds.
  *
  * @param string $key
  * @param int $ttl
  * @param string $value
  *
  * @return bool: TRUE if the command is successful.
  * @link http://redis.io/commands/setex
  * @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
  */
 public function setEx($key, $ttl, $value)
 {
     $this->appendToLog('SETEX ' . $key . ' ' . $value . ' ' . $ttl);
     return $this->client->setEx($key, $ttl, $value);
 }