Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example script to demonstrate the per item expire issue.
@load base/frameworks/communication
redef exit_only_after_terminate = T;
redef table_expire_interval = 1sec;
global start_time: time;
function time_past(): interval
{
return network_time() - start_time;
}
function expire_nums(tbl: table[count] of string, idx: count): interval
{
print fmt("Expired Num: %s --> %s at %s", idx, tbl[idx], time_past());
return 23sec;
}
global nums: table[count] of string &read_expire=0sec &expire_func=expire_nums;
global step: count;
event test()
{
++step;
print fmt("Step: %s at %s", step, time_past());
if ( step == 3 )
{
print fmt("Accessed %s -> %s", 2, nums[2]);
print fmt("Accessed %s -> %s", 3, nums[3]);
}
if ( step < 6 )
schedule 5sec { test() };
else
terminate();
}
event bro_init() &priority=-10
{
step = 0;
start_time = network_time();
nums[0] = "zero";
nums[1] = "one";
nums[2] = "two";
nums[3] = "three";
schedule 0sec { test() };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.