Forum Discussion

trx's avatar
Mar 18, 2011

local vs. global variables scenario question

Hello Community,

If a local variable is set to "0" in the request event, then changed to 1 due to some logic, the very next time the even executes again the variable will set back to "0". The goal is keep the variable at it's current value state and NOT be reset. How would one resolve that issue without global variables?

 

 

 

Regards,

 

TRX

 

  • Hi TRX,

     

     

    How about setting the local variable to 0 in CLIENT_ACCEPTED and then modifying it to 1 in HTTP_REQUEST only if some condition is true? That would be valid for the life of the TCP connection. If you want to have the variable available for all connections globally, you could use a subtable to hold the value.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/table

     

     

    Aaron
  • Thanks Aaron. You are good man.

     

     

    Regards,

     

    TRX