/**
  * Returns processed keyspace schema description that is also cached if
  * possible (APC caching enabled).
  *
  * @param string $keyspace Optional keyspace, current used if not set
  * @param boolean $useCache Should caching be used if possible
  * @return array Keyspace schema description with column families metadata
  */
 public function getKeyspaceSchema($keyspace = null, $useCache = true)
 {
     if ($keyspace === null) {
         $keyspace = $this->cluster->getCurrentKeyspace();
     }
     $cacheKey = 'cassandra.schema|' . $keyspace;
     $schema = false;
     $storeSchema = false;
     if ($useCache && function_exists('apc_fetch')) {
         $schema = apc_fetch($cacheKey);
         $storeSchema = true;
     }
     if ($schema !== false) {
         return $schema;
     }
     $info = $this->describeKeyspace($keyspace);
     $schema = array('name' => $info->name, 'placement-strategy' => $info->strategy_class, 'placement-strategy-options' => $info->strategy_options, 'replication-factor' => $info->replication_factor, 'column-families' => array());
     foreach ($info->cf_defs as $columnFamily) {
         $isSuper = $columnFamily->column_type == 'Super' ? true : false;
         $schema['column-families'][$columnFamily->name] = array('name' => $columnFamily->name, 'super' => $isSuper, 'column-type' => $isSuper ? CassandraUtil::extractType($columnFamily->subcomparator_type) : CassandraUtil::extractType($columnFamily->comparator_type), 'super-type' => $isSuper ? CassandraUtil::extractType($columnFamily->comparator_type) : null, 'data-type' => CassandraUtil::extractType($columnFamily->default_validation_class), 'column-data-types' => array());
         if (is_array($columnFamily->column_metadata) && !empty($columnFamily->column_metadata)) {
             foreach ($columnFamily->column_metadata as $column) {
                 $schema['column-families'][$columnFamily->name]['column-data-types'][$column->name] = CassandraUtil::extractType($column->validation_class);
             }
         }
     }
     if ($storeSchema) {
         apc_store($cacheKey, $schema, 3600);
     }
     return $schema;
 }
 /**
  * @expectedException CassandraConnectionFailedException
  */
 public function testClusterGetConnectionThrowsExceptionIfNoServersAdded()
 {
     $cluster = new CassandraCluster();
     $cluster->getConnection();
 }