Server
class Server extends Server (View source)
Constants
ERROR |
To return an ERR reply from the Redis server. |
NIL |
To return a NULL reply from the Redis server. When used as the 1st parameter "$type" in method \Swoole\Redis\Server::format(), there is no need to pass in the 2nd parameter "$value". |
STATUS |
To return a Status reply from the Redis server. |
INT |
To return an Integer reply from the Redis server. When used as the 1st parameter "$type" in method \Swoole\Redis\Server::format(), the 2nd parameter "$value" must be an integer. |
STRING |
To return a String reply from the Redis server. When used as the 1st parameter "$type" in method \Swoole\Redis\Server::format(), the 2nd parameter "$value" must be a string. |
SET |
To return a Set reply from the Redis server. When used as the 1st parameter "$type" in method \Swoole\Redis\Server::format(), the 2nd parameter "$value" must be an array. |
MAP |
To return a Map reply from the Redis server. When used as the 1st parameter "$type" in method \Swoole\Redis\Server::format(), the 2nd parameter "$value" must be an associative array. |
Properties
$setting | from Server | ||
$connections | from Server | ||
$host | from Server | ||
$port | from Server | ||
$type | from Server | ||
$mode | from Server | ||
$ports | from Server | ||
$master_pid | from Server | ||
$manager_pid | from Server | ||
$worker_id | from Server | ||
$taskworker | from Server | ||
$worker_pid | from Server | ||
$stats_timer | from Server | ||
Server
Since: 4.8.0
|
$admin_server | from Server |
Methods
No description
No description
No description
No description
No description
Get the ID of current worker (either an event worker or a task worker).
Get the process ID of a given worker process (specified by a worker ID).
Run a customized command in a specified process of Swoole.
Add a customized command.
Alias of method \Swoole\Timer::after().
Alias of method \Swoole\Timer::tick().
Set a handler (a callback function) to process a given Redis command.
No description
Format a reply.
Details
__construct($host, $port = null, $mode = null, $sock_type = null)
No description
__destruct()
No description
mixed
listen(mixed $host, mixed $port, mixed $sock_type)
No description
mixed
addlistener(mixed $host, mixed $port, mixed $sock_type)
No description
mixed
on(mixed $event_name, callable $callback)
No description
mixed
getCallback(mixed $event_name)
No description
mixed
set(array $settings)
No description
mixed
start()
No description
mixed
send(mixed $fd, mixed $send_data, mixed|null $server_socket = null)
No description
mixed
sendto(mixed $ip, mixed $port, mixed $send_data, mixed|null $server_socket = null)
No description
mixed
sendwait(mixed $conn_fd, mixed $send_data)
No description
mixed
exists(mixed $fd)
No description
mixed
exist(mixed $fd)
No description
mixed
protect(mixed $fd, mixed|null $is_protected = null)
No description
mixed
sendfile(mixed $conn_fd, mixed $filename, mixed|null $offset = null, mixed|null $length = null)
No description
mixed
close(mixed $fd, mixed|null $reset = null)
No description
mixed
confirm(mixed $fd)
No description
mixed
pause(mixed $fd)
No description
mixed
resume(mixed $fd)
No description
mixed
task(mixed $data, mixed|null $worker_id = null, callable|null $finish_callback = null)
No description
mixed
taskwait(mixed $data, mixed|null $timeout = null, mixed|null $worker_id = null)
No description
mixed
taskWaitMulti(array $tasks, mixed|null $timeout = null)
No description
mixed
taskCo(array $tasks, mixed|null $timeout = null)
No description
mixed
finish(mixed $data)
No description
mixed
reload()
No description
mixed
shutdown()
No description
mixed
stop(mixed|null $worker_id = null)
No description
mixed
getLastError()
No description
mixed
heartbeat(mixed $reactor_id)
No description
mixed
getClientInfo(mixed $fd, mixed|null $reactor_id = null)
No description
mixed
getClientList(mixed $start_fd, mixed|null $find_count = null)
No description
int|false
getWorkerId()
Get the ID of current worker (either an event worker or a task worker).
int|false
getWorkerPid(int $worker_id = -1)
Get the process ID of a given worker process (specified by a worker ID).
mixed
getWorkerStatus(mixed|null $worker_id = null)
No description
mixed|false
command(string $name, int $process_id, int $process_type, mixed $data, bool $json_decode = true)
Run a customized command in a specified process of Swoole.
bool
addCommand(string $name, int $accepted_process_types, callable $callback)
Add a customized command.
Commands can be added to the master process, the manager process, or worker processes. Commands can only be added before the server is started.
mixed
getManagerPid()
No description
mixed
getMasterPid()
No description
mixed
connection_info(mixed $fd, mixed|null $reactor_id = null)
No description
mixed
connection_list(mixed $start_fd, mixed|null $find_count = null)
No description
mixed
sendMessage(mixed $message, mixed $dst_worker_id)
No description
int|false
addProcess(Process $process)
No description
mixed
stats()
No description
mixed
getSocket(mixed|null $port = null)
No description
mixed
bind(mixed $fd, mixed $uid)
No description
int
after(int $ms, callable $callback, ...$params)
Alias of method \Swoole\Timer::after().
int
tick(int $ms, callable $callback, ...$params)
Alias of method \Swoole\Timer::tick().
bool
clearTimer(int $timer_id)
Alias of method \Swoole\Timer::clear().
true
defer(callable $callback)
Alias of method \Swoole\Event::defer().
bool
setHandler(string $command, callable $callback)
Set a handler (a callback function) to process a given Redis command.
callable|null
getHandler(string $command)
No description
static string|false
format(int $type, mixed|null $value = null)
Format a reply.