_timeout)) { $this->timeout = EXTERNAL_CACHE_INTERVAL_SECONDS; } $this->_use_parent = false; $value = $this->get(EXTERNAL_CACHE_WORKING_CHECK_KEY); if ($value != EXTERNAL_CACHE_WORKING_CHECK_KEY) { $this->set( EXTERNAL_CACHE_WORKING_CHECK_KEY, EXTERNAL_CACHE_WORKING_CHECK_KEY ); $value = $this->get(EXTERNAL_CACHE_WORKING_CHECK_KEY); // Clear the cache statistics after the test. This makes the statistics work out. $GLOBALS['external_cache_request_external_hits'] = 0; $GLOBALS['external_cache_request_external_total'] = 0; } $this->_use_parent = true; $this->initialized = (EXTERNAL_CACHE_WORKING_CHECK_KEY == $value); if (empty($this->_name)) { $this->_name = substr(get_class($this), 11); } } function get($key) { if ($this->_use_parent && !is_null($value = parent::get($key))) { if (EXTERNAL_CACHE_DEBUG) { SugarCache::log("{$this->_name}:: found {$key} in local memory cache"); } return $value; } if(!$GLOBALS['external_cache_enabled']) { if (EXTERNAL_CACHE_DEBUG) { SugarCache::log("{$this->_name}:: caching disabled", 'fail'); } return null; } $GLOBALS['external_cache_request_external_total']++; if(EXTERNAL_CACHE_DEBUG) { SugarCache::log("{$this->_name}:: retrieving key from cache ($key)"); } return null; } function _realKey($key) { return $GLOBALS['sugar_config']['unique_key'] . $key; } function _processGet($key, $value) { if (!empty($value)) { if (EXTERNAL_CACHE_DEBUG) { SugarCache::log("{$this->_name}:: Retrieved from external cache: {$key}", 'pass'); } $GLOBALS['external_cache_request_external_hits']++; $this->_cache[$key] = $value; return $this->_cache[$key]; } if(EXTERNAL_CACHE_DEBUG) { SugarCache::log("{$this->_name}:: External cache retrieve failed: $key", 'fail'); } return null; } }