public static Cassandra.Client GetClient() { if (_client == null) { if (_transport == null) { _transport = new TFramedTransport(new TSocket("localhost", 9160)); } var client = new Cassandra.Client(new TBinaryProtocol(_transport)); if (!_transport.IsOpen) { try { _transport.Open(); } catch (Exception e) { Utility.Logging("transport open fail:" + e.Message); } } if (!_setKeySpace) { client.set_keyspace(_keySpace); _setKeySpace = true; } //return client; _client = client; } return(_client); }
public static Cassandra.Client GetWebClient() { var transport = new TFramedTransport(new TSocket("localhost", 9160)); var client = new Cassandra.Client(new TBinaryProtocol(transport)); transport.Open(); client.set_keyspace(_keySpace); return(client); }
public static Cassandra.Client GetClient(string keyspace, ref TTransport transport) { TTransport frameTransport = new TFramedTransport(new TSocket("localhost", 9160)); TProtocol frameProtocol = new TBinaryProtocol(frameTransport); var client = new Cassandra.Client(frameProtocol, frameProtocol); frameTransport.Open(); client.set_keyspace(keyspace); transport = frameTransport; return(client); }
public static Cassandra.Client GetClient() { if (_transport == null) { _transport = new TFramedTransport(new TSocket("localhost", 9160)); } TProtocol frameProtocol = new TBinaryProtocol(_transport); var client = new Cassandra.Client(frameProtocol); if (!_transport.IsOpen) { _transport.Open(); } client.set_keyspace(_keySpace); return(client); }