private static function cache()
    {
        if (is_null(self::$memcached) && class_exists('Memcached')) {
            $servers = [['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100]];

            self::$memcached = new Memcached();

            foreach ($servers as $server) {
                self::$memcached->addServer(
                    $server['host'], $server['port'], $server['weight']
                );
            }

            if (self::$memcached->getVersion() === false) {
                throw new \RuntimeException("Could not establish Memcached connection.");
            }
        }

        return self::$memcached;
    }
private static function cache()
    {
        if (is_null(self::$memcached) && class_exists('Memcached')) {
            $servers = [['host' => '127.0.0.1', 'port' => 11211, 'weight' => 100]];

            self::$memcached = new Memcached();

            foreach ($servers as $server) {
                self::$memcached->addServer(
                    $server['host'], $server['port'], $server['weight']
                );
            }

            if (self::$memcached->getVersion() === false) {
                throw new \RuntimeException("Could not establish Memcached connection.");
            }
        }

        return self::$memcached;
    }
private static function cache ( ) { if ( is_null ( self :: $ memcached ) && class_exists ( 'Memcached' ) ) { $ servers = [ [ 'host' => '127.0.0.1' , 'port' => 11211 , 'weight' => 100 ] ] ; self :: $ memcached = new Memcached ( ) ; foreach ( $ servers as $ server ) { self :: $ memcached -> addServer ( $ server [ 'host' ] , $ server [ 'port' ] , $ server [ 'weight' ] ) ; } if ( self :: $ memcached -> getVersion ( ) === false ) { throw new \ RuntimeException ( "Could not establish Memcached connection." ) ; } } return self :: $ memcached ; }
Returns the memcached instance.

@return Memcached
@throws RuntimeException
Returns the memcached instance .