private function initCacheIfNeeded() { if ($this->cache) { return $this->cache; } // init a DiskCache to save all user form data $this->cache = DataCache::factory("DataCache", array()); // cache life time set to 1 hour $this->cache->setCacheLifetime(3600); $this->cache->setCacheGroup("GoogleJSMapImageSize"); }
function getOnlineUsersCount() { $cache = \DataCache::getInstance(); $count = $cache->get('onlineUsersTotalCount'); if ($count === null) { $count = 0; foreach ($this->ccS as $cc) { $count += $cc->getOnlineUsersCount(); } $cache->set('onlineUsersTotalCount', $count, 60); } return $count; }
/** * @return DataCache */ static function getInstance() { if (self::$instance) { return self::$instance; } $config = sfConfig::get('app_data_cache'); if (!isset($config['class'])) { $config['class'] = 'sfNoCache'; } if (!isset($config['param'])) { $config['param'] = array(); } $config['param']['prefix'] = "rayku.com"; self::$instance = new DataCache($config); return self::$instance; }
function __cleanupService() { if (isset($_ENV['SOFTHOOKS']['SHUTDOWN'])) { foreach ($_ENV['SOFTHOOKS']['SHUTDOWN'] as $hook) { executeUserParams($hook["FUNC"], $hook["OBJ"]); } } if (function_exists("runHooks")) { runHooks("serviceClose"); } // saveSettings(); // saveSiteSettings(); saveSession(); MetaCache::getInstance()->dumpAllCache(); DataCache::getInstance()->dumpAllCache(); Database::closeAll(); }
function __commit() { global $database; if (false == $this->usable) { return $this->usable; } if (false == is_array($this->configVal)) { return false; } $element = ''; foreach ($this->configVal as $key => $value) { $element .= "<field name=\"{$key}\" type=\"text\" ><![CDATA[{$value}]]></field>"; } $xml = '<?xml version="1.0" encoding="utf-8"?><config>' . $element . '</config>'; $xml = POD::escapeString($xml); if (defined('__TISTORY__')) { expireGlobalDressing($this->blogid); DataCache::expireData('SkinCache', $this->blogid); globalCacheExpire($this->blogid); } return POD::query("REPLACE INTO {$database['prefix']}Plugins (blogid, name, settings) VALUES({$this->blogid},'{$this->pluginName}', '{$xml}')"); }
public function init($args) { $this->initArgs = $args; if (isset($args['HALT_ON_PARSE_ERRORS'])) { $this->haltOnParseErrors($args['HALT_ON_PARSE_ERRORS']); } $this->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG')); $cacheClass = isset($args['CACHE_CLASS']) ? $args['CACHE_CLASS'] : 'DataCache'; $this->cache = DataCache::factory($cacheClass, $args); }
protected function init($args) { $this->initArgs = $args; if (isset($args['DEBUG_MODE'])) { $this->setDebugMode($args['DEBUG_MODE']); } if (isset($args['OPTIONS']) && is_array($args['OPTIONS'])) { $this->setOptions($args['OPTIONS']); } if (isset($args['AUTHORITY'])) { if ($authority = AuthenticationAuthority::getAuthenticationAuthority($args['AUTHORITY'])) { $this->setAuthority($authority); } } if (!isset($args['PARSER_CLASS'])) { if ($this->DEFAULT_PARSER_CLASS) { $args['PARSER_CLASS'] = $this->DEFAULT_PARSER_CLASS; } elseif (isset($args['DEFAULT_PARSER_CLASS']) && strlen($args['DEFAULT_PARSER_CLASS'])) { $args['PARSER_CLASS'] = $args['DEFAULT_PARSER_CLASS']; } else { $args['PARSER_CLASS'] = 'PassthroughDataParser'; } } if (!isset($args['CACHE_LIFETIME'])) { $args['CACHE_LIFETIME'] = $this->DEFAULT_CACHE_LIFETIME; } // instantiate the parser class $parser = DataParser::factory($args['PARSER_CLASS'], $args); $this->setParser($parser); $cacheClass = isset($args['CACHE_CLASS']) ? $args['CACHE_CLASS'] : 'DataCache'; $this->cache = DataCache::factory($cacheClass, $args); }
function _cachePrint($cacheID) { $cache = DataCache::getInstance(); return $cache->printCacheFromID($cacheID); }
protected function init($args) { //get global options from the site data_retriever section $args = array_merge(Kurogo::getOptionalSiteSection('data_retriever'), $args); $this->initArgs = $args; if (isset($args['DEBUG_MODE'])) { $this->setDebugMode($args['DEBUG_MODE']); } if (isset($args['DEFAULT_CACHE_LIFETIME'])) { $this->DEFAULT_CACHE_LIFETIME = $args['DEFAULT_CACHE_LIFETIME']; } if (isset($args['OPTIONS']) && is_array($args['OPTIONS'])) { $this->setOptions($args['OPTIONS']); } if (isset($args['AUTHORITY'])) { if ($authority = AuthenticationAuthority::getAuthenticationAuthority($args['AUTHORITY'])) { $this->setAuthority($authority); } } if (!isset($args['PARSER_CLASS'])) { if ($this->DEFAULT_PARSER_CLASS) { $args['PARSER_CLASS'] = $this->DEFAULT_PARSER_CLASS; } elseif (isset($args['DEFAULT_PARSER_CLASS']) && strlen($args['DEFAULT_PARSER_CLASS'])) { $args['PARSER_CLASS'] = $args['DEFAULT_PARSER_CLASS']; } else { $args['PARSER_CLASS'] = 'PassthroughDataParser'; } } if (isset($args['CACHE_LIFETIME'])) { $this->cacheLifetime = $args['CACHE_LIFETIME']; } else { $args['CACHE_LIFETIME'] = $this->DEFAULT_CACHE_LIFETIME; } if (isset($args['SHOW_WARNINGS'])) { $this->showWarnings = (bool) $args['SHOW_WARNINGS']; } // instantiate the parser class $parser = DataParser::factory($args['PARSER_CLASS'], $args); $this->setParser($parser); $cacheClass = isset($args['CACHE_CLASS']) ? $args['CACHE_CLASS'] : 'DataCache'; $this->cache = DataCache::factory($cacheClass, $args); }