code: public function set($key, $value)
      {
          if (func_num_args() > 2) {
              $args = func_get_args();
              array_shift($args);
              array_shift($args);
  
              $px = null;
              $ex = null;
              $xx = false;
              $nx = false;
  
              for ($i = 0, $n = count($args); $i < $n; ++$i) {
                  $arg = strtoupper($args[$i]);
  
                  if ($arg === 'XX') {
                      $xx = true;
                  } elseif ($arg === 'NX') {
                      $nx = true;
                  } elseif ($arg === 'EX' || $arg === 'PX') {
                      if (!isset($args[$i + 1])) {
                          throw new InvalidArgumentException('ERR syntax error');
                      }
                      $num = $this->coerceInteger($args[++$i]);
                      if ($num <= 0) {
                          throw new InvalidArgumentException('ERR invalid expire time in SETEX');
                      }
  
                      if ($arg === 'EX') {
                          $ex = $num;
                      } else {
                          $px = $num;
                      }
                  } else {
                      throw new InvalidArgumentException('ERR syntax error');
                  }
              }
  
              if ($nx && $this->storage->hasKey($key)) {
                  return null;
              }
  
              if ($xx && !$this->storage->hasKey($key)) {
                  return null;
              }
  
              if ($ex !== null) {
                  $px += $ex * 1000;
              }
  
              if ($px !== null) {
                  return $this->psetex($key, $px, $value);
              }
          }
  
          $this->storage->setString($key, $value);
  
          return true;
      }
docs: StatusReply