public function useCDN($cdn) {

    // This should not happen, but has happened when service
    // catalog was bad.
    if (empty($cdn)) {
      throw new \HPCloud\Exception('Cannot use CDN: No CDN provided.');
    }

    $containers = $cdn->containers(TRUE);
    $buffer = array();

    foreach ($containers as $item) {
      // This is needed b/c of a bug in SOS that sometimes
      // returns disabled containers (DEVEX-1733).
      if ($item['cdn_enabled'] == 1) {
        $buffer[$item['name']] = array(
          'url' => $item['x-cdn-uri'],
          'sslUrl' => $item['x-cdn-ssl-uri'],
        );
      }
    }
    $this->cdnContainers = $buffer;

    return $this;
  }
public function useCDN($cdn) {

    // This should not happen, but has happened when service
    // catalog was bad.
    if (empty($cdn)) {
      throw new \HPCloud\Exception('Cannot use CDN: No CDN provided.');
    }

    $containers = $cdn->containers(TRUE);
    $buffer = array();

    foreach ($containers as $item) {
      // This is needed b/c of a bug in SOS that sometimes
      // returns disabled containers (DEVEX-1733).
      if ($item['cdn_enabled'] == 1) {
        $buffer[$item['name']] = array(
          'url' => $item['x-cdn-uri'],
          'sslUrl' => $item['x-cdn-ssl-uri'],
        );
      }
    }
    $this->cdnContainers = $buffer;

    return $this;
  }
public function useCDN ( $ cdn ) { // This should not happen, but has happened when service // catalog was bad. if ( empty ( $ cdn ) ) { throw new \ HPCloud \ Exception ( 'Cannot use CDN: No CDN provided.' ) ; } $ containers = $ cdn -> containers ( TRUE ) ; $ buffer = array ( ) ; foreach ( $ containers as $ item ) { // This is needed b/c of a bug in SOS that sometimes // returns disabled containers (DEVEX-1733). if ( $ item [ 'cdn_enabled' ] == 1 ) { $ buffer [ $ item [ 'name' ] ] = array ( 'url' => $ item [ 'x-cdn-uri' ] , 'sslUrl' => $ item [ 'x-cdn-ssl-uri' ] , ) ; } } $ this -> cdnContainers = $ buffer ; return $ this ; }
Indicate that this ObjectStorage instance should use the given CDN service.

This will cause this ObjectStorage instance to use CDN as often as it can.
Any containers (and subsequently container objects) that can leverage
CDN services will act accordingly.

CDN is used for *read* operations. Because CDN is a time-based cache,
objects in CDN can be older than objects in Swift itself. For that
reason, CDN should not be used when a combination of read and write
operations occur.

@retval HPCloud::Storage::ObjectStorage
@return \HPCloud\Storage\ObjectStorage
$this for current object so the method can be used in chaining.
Indicate that this ObjectStorage instance should use the given CDN service .