Changeset 2394

Show
Ignore:
Timestamp:
04/01/2008 05:08:13 AM (6 months ago)
Author:
Geert
Message:

Fixed another small cache bug. The requests config reads as follows: there is 1 out of {requests} chances that garbage collection will be triggered. However, setting requests to 1 would only give you 1 out of 2 chances. Not anymore.

Location:
trunk/system
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/config/cache.php

    r2361 r2394  
    2222 *  requests - Average number of cache requests that will processed before all expired 
    2323 *             caches are deleted. This is commonly referred to as "garbage collection". 
    24  *             Setting this to a negative number will disable automatic garbage collection. 
     24 *             Setting this to 0 or a negative number will disable automatic garbage collection. 
    2525 */ 
    2626$config['default'] = array 
  • trunk/system/libraries/Cache.php

    r2377 r2394  
    8282                if (self::$loaded !== TRUE) 
    8383                { 
    84                         if (mt_rand(0, (int) $this->config['requests']) === 1) 
     84                        $this->config['requests'] = (int) $this->config['requests']; 
     85 
     86                        if ($this->config['requests'] > 0 AND mt_rand(1, $this->config['requests']) === 1) 
    8587                        { 
    8688                                // Do garbage collection