Forum Discussion
Append to list stored in table key
Hi Piotr,
Sorry didn't want to confuse you... 😉
The code above is just a sample code based on some of your previous questions (aka. master table), but also contains the handling of IPs per session_id table entries. The important part of this code is, that you could check a lot of things in a single [table] query to speed up the processing of most of your requests and that you could hide the complex stuff (e.g. counting limits, creation new session_id and master_table updates or new IP_addr entries) as an exception to this initial [table] query. The task of the exception code path is then to analyze why the initial [table] query has failed and then correct this situation, by inserting additional session_id or IP_addr, so that the very next request from the same session_id and IP_addr could be handeled using the fast single [table] query.
Basically you should try the fastest method first (because it should work most of the time), then catch the possible errors/exceptions/empty results followed by an analyses of whats was going wrong and a fix to make sure the next request won't fail again. The opposite approach would be to perform a rather complex error handling on each request to make sure that the used [table] query never fails...
Regarding $temp(session_id_counter). This is not a statement, it an [array] variable that can be used as an alternative to classic variables. The handling would look like this....
set temp(var1) "value1" set temp(var2) "value2" lappend temp(var2) "value3" set temp(var_index) [array names temp -glob "value*"] unset temp(var3) unset temp etc.
And yes, it is somewhat hard to get a feeling of which command is faster than the other. The available information is unfortunately distributed across the internet and spanning a lot articles, different wiki sites and forum posts. But even if you found some information then it may be already outdated... So in the end you may want to measure the performance of each code block by yourself, using Event timing on or [clock clicks] timestamps with or without some additional [while] or [for] loops. Over the time you'll get the experience which code block should be used for a given scenario...
BTW: [drop] is working. But you can't send a [HTTP::respond] and [drop] at the same time. BTW2: The -nocomplain option could be skipped in this case. But I tend to use this option in most cases...
Cheers, Kai
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com