Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Do you have a list of objects with set expiry times?</p> <p>e.g. obj1, expires at 12:35:01 obj2, expires at 12:37:14 obj3, expires at 12:38:56 obj4, expires at 12:43:44</p> <p>If we know the expiry times when the collection is created we can use a single timer and a list of intervals to trigger the timer when the objects need to be removed</p> <p>e.g.</p> <pre><code> Wait time in seconds To Be Removed int1 12:35:01 - now() obj1 int2 12:37:14 - 12:35:01 obj2 int3 12:38:56 - 12:37:14 obj3 int4 12:43:44 - 12:38:56 obj4 </code></pre> <p>A) Peek the first entry in the 'delta list' (I have heard it called this before but could not give you a citation) and set the timer interval to the wait time.</p> <p>B) When the timer tiggers, remove the first entry from the delta list and do whatever needs to be done with the object from the source collection.</p> <p>Back to A</p> <p>When an item is added to the collection you need to add a new entry to the delta list in the correct position. Not overly complicated but allow for the timer popping while you are in the middle of adding. </p> <p>Pros: Only one timer. It's all you need. A timer per object is going to suck up a lot of resources.</p> <p>You only need to check through your whole collection at startup and then partial scans whenever new items are added.</p> <p>Never miss an expiry. It may not be important but a fixed time check means that we are late on removing some items.</p> <p>Cons: More complicated to implement than simply scanning the whole collection on a timer pop.</p> <p>Before changing anything, is the current implementation causing any problems?</p> <p>You will get a performance bump from the timer popping only when needed and from not having to scan the list each time. Are we talking 100 entries or 100,000? Would the performance bump be noticeable?</p> <p>You will no longer have any 'late' expiries (being removed from the list after their time out). Does this matter?</p> <p>hth, Alan</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload