Forum Discussion
mgpspr_213832
Nimbostratus
Aug 07, 2015how to match against a list in v11?
I'm basically trying to consolidate the endpoints and move away from data groups. That way, when people modify the iRule, everything is transparent to the editor, they dont have to go in and check ot...
- Aug 07, 2015
class match works only with datagroups. It does not work with Tcl lists. The drawbacks of not using datagroups include:
- class matching runs in O(1) time, so the size of the datagroup does not affect the search performance. This is not true for Tcl lists (though you should get something better than O(n) for large lists if you use a Tcl dictionary);
- using Tcl lists generally require "inflating" the lists before the command can operate on it, which consumes CPU and memory;
- modifying an iRule requires technicians and engineers to know code, at least to some degree, and the list elements cannot be changed via
tmshor the WebUI.
Having said that, to search a Tcl list, you can use the lsearch method:
when RULE_INIT { set static::endpoints [list /about /cblock] } when HTTP_REQUEST { if { [lsearch -glob $static::endpoint "[HTTP::uri]*"] != -1 } { pool cms } }There are other ways, but this is likely the simplest.
VernonWells
Employee
Aug 07, 2015class match works only with datagroups. It does not work with Tcl lists. The drawbacks of not using datagroups include:
- class matching runs in O(1) time, so the size of the datagroup does not affect the search performance. This is not true for Tcl lists (though you should get something better than O(n) for large lists if you use a Tcl dictionary);
- using Tcl lists generally require "inflating" the lists before the command can operate on it, which consumes CPU and memory;
- modifying an iRule requires technicians and engineers to know code, at least to some degree, and the list elements cannot be changed via
tmshor the WebUI.
Having said that, to search a Tcl list, you can use the lsearch method:
when RULE_INIT {
set static::endpoints [list /about /cblock]
}
when HTTP_REQUEST {
if { [lsearch -glob $static::endpoint "[HTTP::uri]*"] != -1 } {
pool cms
}
}
There are other ways, but this is likely the simplest.
- mgpspr_213832Aug 07, 2015
Nimbostratus
Fantastic write up - thx.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
