Hi Raj,
you may try the following...
set mytemp_var1 1
set mytemp_var2 1
set mytemp_var3 1
set mytemp_var4 1
set mytemp_var5 1
set mytemp_var6 1
set mytemp_var7 1
set mytemp_var8 1
set mytemp_var9 1
set mytemp_var10 1
set mytemp_var11 1
set mytemp_var12 1
set mytemp_var13 1
set mytemp_var14 1
set mytemp_var15 1
set mytemp_var16 1
set mytemp_var17 1
set mytemp_var18 1
set mytemp_var19 1
set mytemp_var20 1
log local0.debug "Classic \$mytemp_* variables: [info local mytemp_*]"
set timestamp_start [clock clicks]
eval "unset -nocomplain [info local mytemp_*]"
set timestamp_stop [clock clicks]
log local0.debug "Flushed the classic \$mytemp_* variables in [expr { $timestamp_stop - $timestamp_start - 2 }] clicks."
log local0.debug "Leftover \$mytemp_* variables: [info local mytemp_*]"
Log Output:
Rule /Common/AA_Debug1 : Classic $mytemp_* variables: mytemp_var13 mytemp_var14 mytemp_var15 mytemp_var16 mytemp_var17 mytemp_var18 mytemp_var1 mytemp_var20 mytemp_var19 mytemp_var2 mytemp_var3 mytemp_var4 mytemp_var5 mytemp_var6 mytemp_var7 mytemp_var8 mytemp_var10 mytemp_var9 mytemp_var11 mytemp_var12
Rule /Common/AA_Debug1 : Flushed the classic $mytemp_* variables in 31 clicks.
Rule /Common/AA_Debug1 : Leftover $mytemp_* variables:
... or if performance is a requirement for you then change your code to use $array(variables) ...
set mytemp(var1) 1
set mytemp(var2) 1
set mytemp(var3) 1
set mytemp(var4) 1
set mytemp(var5) 1
set mytemp(var6) 1
set mytemp(var7) 1
set mytemp(var8) 1
set mytemp(var9) 1
set mytemp(var10) 1
set mytemp(var11) 1
set mytemp(var12) 1
set mytemp(var13) 1
set mytemp(var14) 1
set mytemp(var15) 1
set mytemp(var16) 1
set mytemp(var17) 1
set mytemp(var18) 1
set mytemp(var19) 1
set mytemp(var20) 1
log local0.debug "Array \$mytemp variables: [array names mytemp]"
set timestamp_start [clock clicks]
unset -nocomplain mytemp
set timestamp_stop [clock clicks]
log local0.debug "Flushed the array \$mytemp variables in [expr { $timestamp_stop - $timestamp_start - 2 }] clicks."
log local0.debug "Leftover \$mytemp variables: [array exists mytemp]"
Log Output:
Rule /Common/AA_Debug1 : Array $mytemp variables: var16 var7 var17 var8 var18 var9 var20 var19 var1 var10 var2 var11 var3 var12 var13 var4 var14 var5 var15 var6
Rule /Common/AA_Debug1 : Flushed the array $mytemp variables in 3 clicks.
Rule /Common/AA_Debug1 : Leftover $mytemp variables: 0
Note: Using $array(variables) is much faster if you need to create AND delete them on each single request (aka. using per-request variables). Personally I always use four different kinds of $array(variables) in my own iRules. $static::global(), $session(), $conf() and $temp(). The $static::global() will store global configuration, the $session() variables will persist for an entire TCP session. The $conf() variables may changed/deleted as needed and $temp() variables will be flushed on each single request (or on demand if the containig data is large). This simple procedure makes the handling of $variables a no brainer even for the most complex iRules...
Cheers, Kai