Forum Discussion
dragonflymr
Dec 14, 2015Cirrostratus
Append to list stored in table key
Hi,
First of all I wonder if this is good idea to store list in sub/table key - considering performance nad memory consummatum. Let's say it could be list containing no more that 10 IPs.
Second I...
dragonflymr
Dec 14, 2015Cirrostratus
Well, so here is my goal, probably what I posted was a bit misleading:
When http req check if given cookie exists and created entry in sub/table using as a key session id value from cookie and as value list with client IP address.
Then for each new connection check if IP in the list is the same, if not add new IP as next entry in the list.
timeout and lifetime for table key is irrelevant here - it will be set depending on situation.
So code could be:
when HTTP_REQUEST {
set s_id [HTTP::cookie value $my_cookie]
if { [table lookup $s_id] eq "" } {
table set $s_id [IP::client_addr]
} else {
set cur_v [table lookup $s_id]
if { [lsearch $cur_v [IP::client_addr]] == -1 } {
lappend cur_v [IP::client_addr]
table set $s_id $cur_v
}
}
Just wonder if it can be done in more optimized way.
Piotr
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects