Forum Discussion
Hi Piotr,
You can initialize (aka. "set") a new COOKIE_VALUE by specifying the subtable name "master_table[expr {[crc32 $COOKIE_VALUE] % $NUMBER_OF_TABLES}]", the KEY_NAME "$COOKIE_VALUE" and KEY_VALUE "1".
You can write data related to a COOKIE_VALUE by specifying the subtable name "$COOKIE_VALUE", a specific KEY_NAME, and a KEY_VALUE.
You can read data related to a COOKIE_VALUE by specifying the subtable name "$COOKIE_VALUE", a specific KEY_NAME.
You can search the contained KEY_NAMEs of a specific COOKIE_VALUE by specifying the subtable name "$COOKIE_VALUE"
You can check the existence of an existing COOKIE_VALUE by "lookup" the subtable name "$COOKIE_VALUE", some mandatory KEY_NAME (e.g. time stamp, etc.) and validate the output.
You can check the existence of an existing COOKIE_VALUE by "lookup" the subtable name "master_table[expr {[crc32 $COOKIE_VALUE] % $NUMBER_OF_TABLES}]", the KEY_NAME "$COOKIE_VALUE" and validate the output.
You can search a specific session_id or dump every session_ids (aka. data export) by performing "while", "foreach" or "for" to access each of you master tables sequentially.
set table_id 0
while {$table_id < $NUMBER_OF_TABLES} {
foreach session_id [table keys -subtable "master_table$table_id"] {
set KEY_VALUE_A [table lookup $session_id KEY_NAME_A]
...
set KEY_VALUE_Z [table lookup $session_id KEY_NAME_Z]
Perform a "set found_session_id 1" and "break" to skip further foreach processing
}
Evalute "$found_session_id and "break" to skip further while processing
incr table_id
}
foreach table_id { 0 1 2 } {
foreach session_id [table keys -subtable "master_table$table_id"] {
set KEY_VALUE_A [table lookup $session_id KEY_NAME_A]
...
set KEY_VALUE_Z [table lookup $session_id KEY_NAME_Z]
Perform a "set found_session_id 1" and "break" to skip further foreach processing
}
Evalute "$found_session_id and "break" to skip further foreach processing
}
for {set table_id 0} {$table_id < $NUMBER_OF_TABLES} {incr table_id} {
foreach session_id [table keys -subtable "master_table$table_id"] {
set KEY_VALUE_A [table lookup $session_id KEY_NAME_A]
...
set KEY_VALUE_Z [table lookup $session_id KEY_NAME_Z]
Perform a "set found_session_id 1" and "break" to skip further foreach processing
}
Evalute "$found_session_id and "break" to skip further for processing
}
Do you miss anything in particular?
Cheers, Kai