Quote:
1) The data will be stored in 2 hash tables. One of them will have the items expired after a period and the other the items doesn't expired.


OMG i was working on the assumption you were trying to tap into someone elses script/hashtable and trigger events when things unset. So its your own code, so you could easily create a special command such as /haddcommand delimiter args table name value delimiter command
thus the alias can use $1 look for it in $5- and know $5 to the delimiter is the value and after the delimiter is the command. That would make all that insane signal stuff unneeded.

Ill rewrite what i have I think on that basis.

Quote:
Every second it checks the number of items in each of the tables. If the number doesn't match then it finds out which lines are missing (I think that it will require a loop cause /filter doesn't have this kind of option as /filter -xww window1 window2 window3, where the content od window3 will be the lines which are different. Also /filter doesn't work with hash table, but I remember that it was suggested few months ago by saragini). After it execute the command, it will remove the data from the second hash table.


Well bizzarely i just asked a question on how to get the differences between 2 windows the other day, the code is very short, it does uses a loop, but an internal one, by filtering windows 1 to an alias using -k, the alias then sees if the passed value is in window2 and if not writes it to window3, u can get the hash tables into the windows by using LOADBUF although filter works with files, i dont think its as fast, i havent tested that tho.

Quote:
2) the second idea requires only hash table, and its data doesn't expire, but it contains the information about when it needs to be expired. A timer is execute a command every second in order to check if an item need to be expired and then it also execute a command.


My idea is a cross of the two, allow the normal table to exist, and keep a second table (but not hash) of the unsetting ones, which stores data about the unset time etc.

Quote:
A nicer idea is to have the function check when the next item needs to be exired and set the original timer to have a delay that match the expire delay (in order to have a variable delay other than checking the table every second).


well assuming your initial check doesnt have to do much (no looping) then once a second wont be a worry, i have things going off once a second for all types of things, you never even know there happening.

Quote:
Still, it would be nicer having /hadd with an execute option. smile

I hope it is added, it sounds like a excellent idea, im not sure how the command should be passed & stored of course, maybe in a hashtable of commands, with the orginaltablename~itemname as its item name and it as data, but then maybe thats looking at it from a end user point, and Khaled has a much better understanding of the way things would/should be.

Ill post what i have in a few minutes im just bug testing it. Its doing 10,000 unset catches with out lagging in the monitoring of them, of course if all 10,000 unset at once its gonna put some lag on dealing with 10,000 commands LOL