Server IP : 127.0.0.2 / Your IP : 3.144.112.72 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/ |
Upload File : |
<?php namespace Illuminate\Redis; use Closure; use Predis\Client; use Illuminate\Support\Arr; use Illuminate\Contracts\Redis\Database as DatabaseContract; class Database implements DatabaseContract { /** * The host address of the database. * * @var array */ protected $clients; /** * Create a new Redis connection instance. * * @param array $servers * @return void */ public function __construct(array $servers = []) { $cluster = Arr::pull($servers, 'cluster'); $options = array_merge(['timeout' => 10.0], (array) Arr::pull($servers, 'options')); if ($cluster) { $this->clients = $this->createAggregateClient($servers, $options); } else { $this->clients = $this->createSingleClients($servers, $options); } } /** * Create a new aggregate client supporting sharding. * * @param array $servers * @param array $options * @return array */ protected function createAggregateClient(array $servers, array $options = []) { return ['default' => new Client(array_values($servers), $options)]; } /** * Create an array of single connection clients. * * @param array $servers * @param array $options * @return array */ protected function createSingleClients(array $servers, array $options = []) { $clients = []; foreach ($servers as $key => $server) { $clients[$key] = new Client($server, $options); } return $clients; } /** * Get a specific Redis connection instance. * * @param string $name * @return \Predis\ClientInterface|null */ public function connection($name = 'default') { return Arr::get($this->clients, $name ?: 'default'); } /** * Run a command against the Redis database. * * @param string $method * @param array $parameters * @return mixed */ public function command($method, array $parameters = []) { return call_user_func_array([$this->clients['default'], $method], $parameters); } /** * Subscribe to a set of given channels for messages. * * @param array|string $channels * @param \Closure $callback * @param string $connection * @param string $method * @return void */ public function subscribe($channels, Closure $callback, $connection = null, $method = 'subscribe') { $loop = $this->connection($connection)->pubSubLoop(); call_user_func_array([$loop, $method], (array) $channels); foreach ($loop as $message) { if ($message->kind === 'message' || $message->kind === 'pmessage') { call_user_func($callback, $message->payload, $message->channel); } } unset($loop); } /** * Subscribe to a set of given channels with wildcards. * * @param array|string $channels * @param \Closure $callback * @param string $connection * @return void */ public function psubscribe($channels, Closure $callback, $connection = null) { return $this->subscribe($channels, $callback, $connection, __FUNCTION__); } /** * Dynamically make a Redis command. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { return $this->command($method, $parameters); } }