Forum Discussion
irule subtable learning problem
- Dec 21, 2018
Hello Wang,
I'll try to break down each of the parts of the code that you have question marks next to.
set timer [after 60000 -periodic { table lookup -subtable $tbl $key }] //????
This creates a timer for a command, telling it to repeat every 60000 milliseconds. The command that will be repeated every 60000 milliseconds is:
table lookup -subtable $tbl $key
This command checks the $tbl subtable (a subtable created at the beginning of the Irule that equals the source IP address). The value will be "ignore." Since it is being referenced every 60 seconds, and the default timeout for a table entry is 180 seconds, the cache is prevented from deleting the table value. This line is being used to create a pseudo keep-alive for that entry in the subtable by referencing it every 60000 milliseconds.
when CLIENT_CLOSED { after cancel $timer //??? table delete -subtable $tbl $key
This event happens when the client closes a connection. "after cancel" is a command that stops a timer from running, in this case the timer
[after 60000 -periodic { table lookup -subtable $tbl $key }]
is stopped. The entry in the subtable is then deleted when the timer runs out.
Feel free to ask if you have any follow-up questions,
Austin
Hello Wang,
I'll try to break down each of the parts of the code that you have question marks next to.
set timer [after 60000 -periodic { table lookup -subtable $tbl $key }]
//????
This creates a timer for a command, telling it to repeat every 60000 milliseconds. The command that will be repeated every 60000 milliseconds is:
table lookup -subtable $tbl $key
This command checks the $tbl subtable (a subtable created at the beginning of the Irule that equals the source IP address). The value will be "ignore." Since it is being referenced every 60 seconds, and the default timeout for a table entry is 180 seconds, the cache is prevented from deleting the table value. This line is being used to create a pseudo keep-alive for that entry in the subtable by referencing it every 60000 milliseconds.
when CLIENT_CLOSED {
after cancel $timer
//???
table delete -subtable $tbl $key
This event happens when the client closes a connection. "after cancel" is a command that stops a timer from running, in this case the timer
[after 60000 -periodic { table lookup -subtable $tbl $key }]
is stopped. The entry in the subtable is then deleted when the timer runs out.
Feel free to ask if you have any follow-up questions,
Austin
Recent Discussions
Related Content
* 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