public CassandraKeyspace(CassandraKeyspaceSchema schema, CassandraContext context) { if (schema == null) { throw new ArgumentNullException("schema"); } if (schema.Name == null) { throw new ArgumentException("Must specify the keyspace name."); } _keyspaceName = schema.Name; _cachedSchema = schema; _context = context; }
public CassandraKeyspaceSchema GetSchema() { if (_cachedSchema == null) { try { _cachedSchema = new CassandraKeyspaceSchema(_context.ExecuteOperation(new SimpleOperation <Apache.Cassandra.KsDef>(ctx => { return(ctx.Session.GetClient().describe_keyspace(KeyspaceName)); }))); } catch (CassandraOperationException exc) { Debug.WriteLine(exc); _cachedSchema = new CassandraKeyspaceSchema { Name = KeyspaceName }; } } return(_cachedSchema); }
public void ClearCachedKeyspaceSchema() { _cachedSchema = null; }