[PHPLIB] About gc() in session.inc From: Ronny Hanssen (ronnyh <email protected>)
Date: 11/21/99

Hi,

I was studying how the garbage collection was working in session.inc
when I came across a double implementation of gc() in session.inc.
(Version: $Id: session.inc,v 1.45 1999/10/24 12:15:21 kk Exp $)

It seems that the first one is perhaps an old version which has been
replaced by a new one later. The first implementation doesn't care about
gc_probability, whereas the second one does. This is the first one:

  ##
  ## Garbage collection
  ##
  ## Destroy all session data older than this
  ##
  function gc() {
      $this->that->ac_gc($this->gc_time, $this->name);
  }

The second one looks like this:

  ##
  ## Garbage collection
  ##
  ## Destroy all session data older than this
  ##
  function gc() {
    srand(time());
    if ((rand()%100) < $this->gc_probability) {
      $this->that->ac_gc($this->gc_time, $this->name);
    }
  }

I realize that the last one is the one that is being used, as far as I
can see. However, the inrepreter doesn't like these does it? Just wants
to make sure that it is working as intended.

--
Ronny
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.