Ignore:
Timestamp:
Dec 18, 2005 12:16:03 AM (18 years ago)
Author:
scdev
Message:

detabbed all files ;P

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SessionCache.inc.php

    r41 r42  
    8888     * @param str   $var_id       An identifyer for the cached object.
    8989     * @param bool  $force_it_in  If we have something really big that we
    90      *                            still want to cache, setting this true 
     90     *                            still want to cache, setting this true
    9191     *                            allows this.
    9292     *
     
    106106        $serialized_var = serialize($var);
    107107        $serialized_var_len = strlen($serialized_var);
    108        
     108
    109109        if ($serialized_var_len >= $this->getParam('soft_limit') && !$force_it_in) {
    110110            App::logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $this->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__);
    111111            return false;
    112112        }
    113        
     113
    114114        if ($serialized_var_len >= $this->getParam('hard_limit')) {
    115115            App::logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $this->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__);
     
    122122            unset($_SESSION['_session_cache'][$var_id]);
    123123            // Continue to prune the cache if it's length is too long for the new variable to fit, but keep at least MIN_ITEMS at least.
    124             while (strlen(serialize($_SESSION['_session_cache'])) + $serialized_var_len >= $this->getParam('soft_limit') 
     124            while (strlen(serialize($_SESSION['_session_cache'])) + $serialized_var_len >= $this->getParam('soft_limit')
    125125            && sizeof($_SESSION['_session_cache']) >= $this->getParam('min_items')) {
    126126                array_shift($_SESSION['_session_cache']);
     
    128128        }
    129129        $_SESSION['_session_cache'][$var_id] =& $serialized_var;
    130        
     130
    131131        if ($serialized_var_len >= 1024000) {
    132132            App::logMsg(sprintf('Successfully cached oversized variable (%s bytes).', $serialized_var_len), LOG_DEBUG, __FILE__, __LINE__);
    133133        }
    134        
     134
    135135        return $var_id;
    136136    }
    137    
    138     /**
    139      * Retrives an object from the session cache and returns it unserialized. 
     137
     138    /**
     139     * Retrives an object from the session cache and returns it unserialized.
    140140     * It also moves it to the top of the stack, which makes it such that the
    141141     * cache flushing mechanism of putCache deletes the oldest referenced items
     
    155155            return false;
    156156        }
    157        
     157
    158158        $var_id = md5($var_id);
    159159        if (isset($_SESSION['_session_cache'][$var_id])) {
     
    168168        }
    169169    }
    170    
     170
    171171    /**
    172172     * Tells you if the object is cached.
     
    189189        return isset($_SESSION['_session_cache'][$var_id]);
    190190    }
    191    
     191
    192192    /**
    193193     * Tells you if the object is cached.
Note: See TracChangeset for help on using the changeset viewer.