We are into developing groovy scripts these days and I have pondered about how to make the key a variable and today, I have come across a use case and a way to do this.
If you have a Map of [name : value], the name here itself is a literal, but if you would like the name to be a variable, you would have to enclose it within a paranthesis. For instance, this map would become [(name) : value]. Let us day, if we have defined name as
def name = "test", the output of the map will be {"test" : value}, instead of {name: value}. Here since the name is enclosed within a paranthesis, essentially it acts like a bind variable and replaces the derived value of "name", which turns out to be "test" in this case.
Thursday, June 14, 2012
Tuesday, January 31, 2012
Cassandra
Here are some of the Cassandra terminologies:
1. Keyspaces are similar to schemas/databases.
Here is an example of how to create a keyspace.
2. Column families are similar to tables.
1. Keyspaces are similar to schemas/databases.
Here is an example of how to create a keyspace.
create keyspace endpoint_scripts
with placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy'
and strategy_options=[{eu-west:3, us-east:3}];
2. Column families are similar to tables.
create column family scripts
with comparator = 'UTF8Type'
and key_validation_class = 'UTF8Type'
and default_validation_class = 'BytesType'
and column_metadata=[
{column_name: uri, validation_class: UTF8Type, index_type: 0},
{column_name: revision, validation_class: LongType, index_type: 0},
{column_name: active, validation_class: BooleanType, index_type: 0},
{column_name: user_authentication_required, validation_class: BooleanType, index_type: 0},
{column_name: creation_date, validation_class: DateType, index_type: 0}
]
and rows_cached = 10000
and row_cache_provider = SerializingCacheProvider
and keys_cached = 1.0
and memtable_flush_after = 120
and memtable_operations = 2
and memtable_throughput = 256
and read_repair_chance = 0.0;
Subscribe to:
Posts (Atom)