Forum Discussion
Jun 08, 2010
Another option would be to store the expressions each as a single entry in the string data group
class stream_expressions {
{
"@five@six@"
"@nine@ten@"
"@one@two@"
"@seven@eight@"
"@three@four@"
}
}
Then you could do something like this to pull each one out and append it to a string and use that for the expression
set expressions [class get stream_expressions]
set se ""
foreach {re} $expressions {
append se [lindex $re 0]
}
if { [llength se] > 0 } {
STREAM::expression $se;
} else {
STREAM::disable;
}
}
Of course, you could just store the entire concatenated string as a single entry as well and that would save on some string allocations. The class would look something like this
class stream_expressions {
"@one@two@@three@four@@five@six@@seven@eight@@nine@ten@"
}
And the iRule could be like
set se [lindex [class element 0 stream_expressions] 0];
if { [llength se] > 0 } {
STREAM::expression $se;
} else {
STREAM::disable;
}
}
Hope this helps...
-Joe