public static function redis()
    {
        // Detect when the PID of the current process has changed (from a fork, etc)
        // and force a reconnect to redis.
        $pid = getmypid();
        if (self::$pid !== $pid) {
            self::$redis = null;
            self::$pid   = $pid;
        }

        if(!is_null(self::$redis)) {
            return self::$redis;
        }

        $server = self::$redisServer;
        if (empty($server)) {
            $server = 'localhost:6379';
        }

        if(is_array($server)) {
            self::$redis = new RedisCluster($server);
        } else {
            if (strpos($server, 'unix:') === false) {
                list($host, $port) = explode(':', $server);
            } else {
                // $server is 'unix:/tmp/redis.sock'
                $host = $server;
                $port = null;
            }
            self::$redis = new Redis($host, $port);
            if (!empty(self::$redisPassword)) {
                self::$redis->auth(self::$redisPassword);
            }
        }

        self::$redis->select(self::$redisDatabase);
        return self::$redis;
    }
public static function redis()
    {
        // Detect when the PID of the current process has changed (from a fork, etc)
        // and force a reconnect to redis.
        $pid = getmypid();
        if (self::$pid !== $pid) {
            self::$redis = null;
            self::$pid   = $pid;
        }

        if(!is_null(self::$redis)) {
            return self::$redis;
        }

        $server = self::$redisServer;
        if (empty($server)) {
            $server = 'localhost:6379';
        }

        if(is_array($server)) {
            self::$redis = new RedisCluster($server);
        } else {
            if (strpos($server, 'unix:') === false) {
                list($host, $port) = explode(':', $server);
            } else {
                // $server is 'unix:/tmp/redis.sock'
                $host = $server;
                $port = null;
            }
            self::$redis = new Redis($host, $port);
            if (!empty(self::$redisPassword)) {
                self::$redis->auth(self::$redisPassword);
            }
        }

        self::$redis->select(self::$redisDatabase);
        return self::$redis;
    }
public static function redis ( ) { // Detect when the PID of the current process has changed (from a fork, etc) // and force a reconnect to redis. $ pid = getmypid ( ) ; if ( self :: $ pid !== $ pid ) { self :: $ redis = null ; self :: $ pid = $ pid ; } if ( ! is_null ( self :: $ redis ) ) { return self :: $ redis ; } $ server = self :: $ redisServer ; if ( empty ( $ server ) ) { $ server = 'localhost:6379' ; } if ( is_array ( $ server ) ) { self :: $ redis = new RedisCluster ( $ server ) ; } else { if ( strpos ( $ server , 'unix:' ) === false ) { list ( $ host , $ port ) = explode ( ':' , $ server ) ; } else { // $server is 'unix:/tmp/redis.sock' $ host = $ server ; $ port = null ; } self :: $ redis = new Redis ( $ host , $ port ) ; if ( ! empty ( self :: $ redisPassword ) ) { self :: $ redis -> auth ( self :: $ redisPassword ) ; } } self :: $ redis -> select ( self :: $ redisDatabase ) ; return self :: $ redis ; }
Return an instance of the Redis class instantiated for Resque.
@return Redis Instance of Redis.
Return an instance of the Redis class instantiated for Resque .