Forum Discussion
Mark_Stradling_
Cirrus
Jul 01, 2010Case Statement Efficiency
Hello,
I'm rewriting very messy iRules. Currently, they are all if / elseif statements which I am converting to switch statements. Upon going through the rule, I realized that a number of va...
Michael_Yates
Nimbostratus
Jul 02, 2010I agree with Bhattman, I would guess that a set of switch statements would be more efficient with a default action in case none of the switch statement conditions have been met.
You can also send multiple switch statements to the same location:
when HTTP_REQUEST {
switch -glob [string tolower[HTTP::uri]] {
"/content1*" -
"/content2*" { pool pool.for.content1and2 }
"/content3*" { pool pool.for.content3 }
default { HTTP::redirect http://[getfield [HTTP::host] ":" 1]/content1 }
}
}
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