Drupal 8 implements a service container, a concept adopted from the Symfony framework. In order to implement a plugin, there needs to be a manager who can discover and process plugin definitions. This manager is defined as a service in a module's services.yml with its required constructor parameters. This allows the service container to initiate the class when it is required.
In our example, the GeoLocatorManager plugin manager discovers the GeoLocator plugin definitions through annotated plugin discovery. After the first discovery, all the known plugin definitions are then cached under the geolocator_plugins cache key.
Plugin managers also provide a method to return these definitions or create an object instance based on an available definition. For the CDN plugin, this would be a full instantiated Cdn class object.
Let's consider the following example:
// Load the manager service.
$geolocator_manager = \Drupal::service('plugin.manager.geolocator');
// Create a class instance through the manager.
$cdn_instance = $unit_manager->createInstance('cdn');
// Get country code.
$country_code = $cdn_instance->geolocate('127.0.0.1');