/** * @return array|bool|string */ public static function getLoad() { if (!Core_Cache::get('server_load')) { if (is_file(self::LOAD_FILE)) { $file_source = (double) Core_Files::getContent(self::LOAD_FILE); list($server_load) = explode(' ', $file_source); Core_Cache::set('server_load', $server_load, 60); } } return Core_Cache::get('server_load'); }
/** * */ protected function loadVersions() { $key = 'web_versions'; $versions_rs = Core_Cache::get($key); if (!$versions_rs) { /** * @var $versions_model Admin_VersionsModel */ $versions_model = Admin_VersionsModel::getInstance(); $versions_rs = $versions_model->get(); Core_Cache::set($key, $versions_rs, 5000); } foreach ($versions_rs as $key => $version_row) { if (cfg()->dev_mode && $version_row['is_dev']) { s()->version->current = $version_row; break; } else { s()->version->current = $version_row; } } }
/** * @param $user_id * @param array $attributes */ public static function injectRefresh($user_id, array $attributes) { $cache_id = self::CACHE_INJECT_PREFIX . $user_id; if (Core_Cache::get($cache_id)) { $attributes = array_merge($attributes, Core_Cache::get($cache_id)); } Core_Cache::set($cache_id, $attributes, 180); }
/** * @param $tag_hash * @param $value * @param null $set_language */ public static function cacheSet($tag_hash, $value, $set_language = null) { return Core_Cache::set(self::genereteCacheId($tag_hash, $set_language), $value, time() + mt_rand(4500, 6000)); }