Mark_Moseley
Nov 14, 2005Nimbostratus
Predefining variables and how iRules work
Hi. This is a two-parter, neither of which I can find answers for but might be using the wrong search terms (in which case, my apologies).
1) Is it possible to pre-define variables in iRules? Just declaring them outside of a when {} context doesn't seem to work:
Gives this error:
line 1: [command is not valid in the current scope] [set hi hi]
I've got a hash map I'd like to use that could be upwards of a few hundred entries, so it'd be nice to not have to initialize the variable over and over. Is there another way to do this?
2) Related to 1, I'm curious how iRules are stored in memory. Is the script compiled to some sort of byte-code at first run and then run from byte-code (or something similar), or is run through the BigIP's implementation of a tcl interpreter from scratch each time? The upshot is I'm wondering if there are optimizations that the BigIP already does that would make it not as necessary for me to worry about 1.]
Thanks!