Xuefer Tinys wrote:
> if i have to unset portion of the $oldTracker. i have to scan? or any
> other way?

Perhaps you could store all data with an index of time rounded off to
minutes (hours, whatever).

Example:

<?php
  //15 minutes -- Change larger/smaller for more/less frequent purges
  $purge_time = 60 * 15
  $now = time();

  //purge old data:
  $old = floor($now - $purge_time) / $purge_time);
  unset($tracker[$old]);

  //store incoming data:
  $current = floor($now / $purge_time);
  $tracker[$current][...whatever you use now...] = ...data...;
?>

If you make the $purge_time *TOO* small, smaller than the frequency with
which the loop runs, then old data will get "missed" and never purged.

The point being to break up your data into "chunks" at a level that
garbage collection won't kill you.

You basically need to run garbage collection more often with smaller
chunks of data to solve your problem.

Exactly how much more often, and how small, depends on your application
more than anything else.

The above will at least let you experiment with different $purge_time
settings to see if there's a "sweet spot" for your garbage collection.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to