Advertisement
Guest User

Kohana connection to Cassandra PHPCassa framework

a guest
Jun 19th, 2011
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php defined('SYSPATH') or die('No direct script access.');
  2. /**
  3. * Cassandra
  4. *
  5. * @package        Cassandra
  6. * @author         Jean-Nicolas Boulay Desjardins
  7. * @copyright      (c) 2011 Jean-Nicolas Boulay Desjardins
  8. * @license        http://www.opensource.org/licenses/isc-license.txt
  9. */
  10.  
  11. class Kohana_CASSANDRA {
  12.  
  13.     public static $pool = NULL;
  14.  
  15.     public static function init()
  16.     {
  17.  
  18. echo '~Hey!~';
  19.  
  20.                 require_once ('phpcassa/connection.php');
  21.                 require_once ('phpcassa/columnfamily.php');
  22.  
  23.                 $config = Kohana::config('cassandra');
  24.  
  25.                 $servers = $config['servers'];
  26.                 $keyspace = $config['keyspace'];
  27.    
  28.         self::$pool = new ConnectionPool($keyspace, $servers);
  29.  
  30.     }
  31.  
  32.     public static function selectColumnFamily($col_fam)
  33.     {
  34.  
  35.         self::init();
  36.  
  37.         return new ColumnFamily(self::$pool, $col_fam);
  38.  
  39.     }
  40.  
  41. } // End of Cassandra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement