Index: branches/2.0/lib/SessionCache.inc.php
===================================================================
--- branches/2.0/lib/SessionCache.inc.php	(revision 156)
+++ branches/2.0/lib/SessionCache.inc.php	(revision 157)
@@ -44,11 +44,9 @@
     function setParam($params)
     {
-        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
-            $this =& SessionCache::getInstance();
-        }
+        $_this =& SessionCache::getInstance();
 
         if (isset($params) && is_array($params)) {
             // Merge new parameters with old overriding only those passed.
-            $this->_params = array_merge($this->_params, $params);
+            $_this->_params = array_merge($_this->_params, $params);
         } else {
             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
@@ -65,10 +63,8 @@
     function getParam($param)
     {
-        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
-            $this =& SessionCache::getInstance();
-        }
-
-        if (isset($this->_params[$param])) {
-            return $this->_params[$param];
+        $_this =& SessionCache::getInstance();
+
+        if (isset($_this->_params[$param])) {
+            return $_this->_params[$param];
         } else {
             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
@@ -95,9 +91,7 @@
     function putCache($var, $var_id, $force_it_in=false)
     {
-        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
-            $this =& SessionCache::getInstance();
-        }
-
-        if (!$this->getParam('enabled')) {
+        $_this =& SessionCache::getInstance();
+
+        if (!$_this->getParam('enabled')) {
             App::logMsg(sprintf('SessionCache not enabled, not saving data.', null), LOG_DEBUG, __FILE__, __LINE__);
             return false;
@@ -108,11 +102,11 @@
         $serialized_var_len = strlen($serialized_var);
 
-        if ($serialized_var_len >= $this->getParam('soft_limit') && !$force_it_in) {
-            App::logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $this->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__);
-            return false;
-        }
-
-        if ($serialized_var_len >= $this->getParam('hard_limit')) {
-            App::logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $this->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__);
+        if ($serialized_var_len >= $_this->getParam('soft_limit') && !$force_it_in) {
+            App::logMsg(sprintf('Serialized variable (%s bytes) more than soft_limit (%s bytes).', $serialized_var_len, $_this->getParam('soft_limit')), LOG_NOTICE, __FILE__, __LINE__);
+            return false;
+        }
+
+        if ($serialized_var_len >= $_this->getParam('hard_limit')) {
+            App::logMsg(sprintf('Serialized variable (%s bytes) more than hard_limit (%s bytes).', $serialized_var_len, $_this->getParam('hard_limit')), LOG_NOTICE, __FILE__, __LINE__);
             return false;
         }
@@ -123,6 +117,6 @@
             unset($_SESSION['_session_cache'][$var_id]);
             // 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.
-            while (strlen(serialize($_SESSION['_session_cache'])) + $serialized_var_len >= $this->getParam('soft_limit')
-            && sizeof($_SESSION['_session_cache']) >= $this->getParam('min_items')) {
+            while (strlen(serialize($_SESSION['_session_cache'])) + $serialized_var_len >= $_this->getParam('soft_limit')
+            && sizeof($_SESSION['_session_cache']) >= $_this->getParam('min_items')) {
                 array_shift($_SESSION['_session_cache']);
             }
@@ -149,9 +143,7 @@
     function getCache($var_id)
     {
-        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
-            $this =& SessionCache::getInstance();
-        }
-
-        if (!$this->getParam('enabled')) {
+        $_this =& SessionCache::getInstance();
+
+        if (!$_this->getParam('enabled')) {
             return false;
         }
@@ -179,9 +171,7 @@
     function isCached($var_id)
     {
-        if (!isset($this) || !is_a($this, 'SessionCache') && !is_subclass_of($this, 'SessionCache')) {
-            $this =& SessionCache::getInstance();
-        }
-
-        if (!$this->getParam('enabled')) {
+        $_this =& SessionCache::getInstance();
+
+        if (!$_this->getParam('enabled')) {
             return false;
         }
