@param string $pid
@param string $key

@return int
328217
public function add($pid, $key) {
		$data = [
			'pid' => $pid,
			'server' => $this->buildServerString(),
			'workerkey' => $key,
		];

		$queueProcess = $this->newEntity($data);
		$this->saveOrFail($queueProcess);

		return $queueProcess->id;
	}
376132
public function zadd($key, ...$dictionary)
    {
        if (count($dictionary) === 1) {
            $_dictionary = [];

            foreach ($dictionary[0] as $member => $score) {
                $_dictionary[] = $score;
                $_dictionary[] = $member;
            }

            $dictionary = $_dictionary;
        }

        return $this->client->zadd($key, ...$dictionary);
    }
272056
def pid(self):
        
        pf = self.path('cmd.pid')
        if not os.path.exists(pf):
            return None
        with open(pf, 'r') as f:
            return int(f.read())
745291
public function kill(int $pid, bool $wait = false): bool
    {
        return $this->process->kill($pid, $wait);
    }
1310622
public function actionTreeMove($id, $pid)
    {
        $child = $this->findModel($id);
        $oldParent = $this->findModel($pid);
        $newParent = $this->findModel(Yii::$app->request->post('pid'));
        $child->move($oldParent, $newParent);
        echo json_encode($child->nodeAttributes($child, $newParent->id, time()));
    }
73341
public function count($key = null)
	{
		if (is_null($key)) {
			return count($this->params);
		}
		return count($this->getArray($key));
	}
700297
public static function markParent($pid)
    {
        $coroutineId = \Swoole\Coroutine::getuid();
        if($coroutineId == $pid){
            return false;
        }
        static::$stackTree[$coroutineId] = $pid;
        return true;
    }
654512
public function getPidLoadInfo($pid)
    {
        $commandsDto = new CommandsExecutionDto();
        $commandsDto->setCommandName(CommandsConstants::GET_PID_LOAD_INFO);
        $commandsDto->setPid($pid);

        return $this->getCommandExecutionResult($commandsDto);
    }
1103676
private long getPID() {
        String commandOutput = executeCommand("$pid").getCommandOutput();

        //Remove all non numeric characters
        commandOutput = commandOutput.replaceAll("\\D", "");

        if (!commandOutput.isEmpty()) {
            return Long.valueOf(commandOutput);
        }

        return -1;
    }
1011458
def pid_from_context(_, context):
    """"""
    pid = (context or {}).get('pid')
    return pid.pid_value if pid else missing
617979
public function isRunning($pid = null)
    {
        $process = $this->getProcess($pid);

        return !$process ? false : true;
    }
1123333
protected function check_post_id( $pid ) {
		if ( is_numeric($pid) && $pid === 0 ) {
			$pid = get_the_ID();
			return $pid;
		}
		if ( !is_numeric($pid) && is_string($pid) ) {
			$pid = PostGetter::get_post_id_by_name($pid);
			return $pid;
		}
		if ( !$pid ) {
			return null;
		}
		return $pid;
	}
1227263
public function currval($table, $pkey){
        $stmt = $this->query("SELECT currval('{$table}_{$pkey}_seq')");

        if (!$stmt)
            return false;

        $ret = $stmt->fetch(PDO::FETCH_NUM);
        if (!$ret){
            $stmt = null;
            return false;
        }

        $stmt = null;
        return $ret[0];
    }
829486
public function setPid($pid)
    {
        if ($this->status != self::STATUS_NEW) {
            throw new \RuntimeException('Cannot set worker pid after worker has started working');
        }

        $this->pid = (int)$pid;
    }
518469
public function isRunning(int $pid): bool
    {
        $cmd = sprintf('kill -0 %d 2>&1', $pid);
        $this->logger->debug(__METHOD__ . ": Exec command: $cmd");
        exec($cmd, $output, $return_var);

        return $return_var === 0;
    }
45590
public function increment(string $key, int $step = 1): int {
		return $this->driver->increment($key, abs($step));
	}
728928
public final DOReader get(final String pid) {
	    DOReader result = null;
	    mapLock.lock();
		if (cacheMap.containsKey(pid)) {
			TimestampedCacheEntry<DOReader> e = cacheMap.remove(pid);
			LOG.debug("cache hit for {}", pid);
			result = e.value();
			// put the cache hit at the end of the FIFO list
			cacheMap.put(pid, e.refresh());
		} else {
		    LOG.debug("cache miss for {}", pid);
		}
		mapLock.unlock();
		return result;
	}