>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>>==>>> // // //==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<<==<<< class CCh_script extends CCh { public function run() { CJsOutput::sendHeaderJs(); cnameの作成(例:"client-loader","admin-loader","install-loader"など) $mname = CEnviro::get("ep-module"); $cname = $mname."-loader"; URLに依存しない固定のckey $ckey = "default"; CSfcacheオブジェの作成 $this->setupCacheObject(); $recs = array(); サーバー側のキャッシュを読み込む if (!( $rec = $this->sfc->get($cname,$ckey) )) { cidを作成する。このcidはloaderのスクリプトの一部なる。 $cid = CSfCache::createCID(time()); loaderをrenderする。cidをパラメタとして送る。 $code = $this->renderCode($cid); サーバー側キャッシュとして保存する。 $rec = $this->sfc->put($code,$cname,$ckey,$cid); } レスポンスとして記憶する。 $recs[$cname] = $rec; クライエント側は送る。 self::outputConcat($recs); } private function renderCode( $cid ) { $appcfg = array(); //-- module モジュール:例 client,admin,install $appcfg["ep-module"] = CEnviro::get("ep-module"); //-- url loaderとserverのURLを設定 $url_loader = CEnviro::get("url-ep"); $appcfg["url-loader"] = $url_loader; $appcfg["url-server"] = dirname($url_loader)."/server.php"; //-- id $cfg = CConfig::get("id"); app-id:アプリケーションID $appcfg["app-id"] = $cfg["app-id"]; ins-id:インスタンスID $appcfg["ins-id"] = $cfg["ins-id"]; //-- loader ローダーのcid $appcfg["ldr-cid"] = $cid; config.cci.inc.php内のldr-itemsは、各データ項目がクライエント側で localStorageに記録されるか、sessionSotrageに記録されるか決定する。 $appcfg["ldr-items"] = $this->getClientCacheItems( $appcfg["ep-module"]); //-- cfcache クライエント側キャッシュの設定項目 $cfg = CConfig::get("cfcache"); $appcfg["cfc-loader"] = $cfg["cfc-loader"]; $appcfg["cfc-local"] = $cfg["cfc-local"]; $appcfg["cfc-session"] = $cfg["cfc-session"]; $appcfg["cfc-loader-expire"] = $cfg["cfc-loader-expire"]; //-- expiration time ローダーの有効期限を設定する header("Content-Type: application/javascript"); if ( $appcfg["cfc-loader"] ) { $t = $appcfg["cfc-loader-expire"]; header("Cache-Control: public, max-age={$t}"); } //-- loader code $js_list = array( "CWagv", "CAjax", "CJsp", "CLoader", ); COb::obStart(); ?> "use strict"; (function(){ function __scope(appcfg){ ### __scope_thisはCJsp::executeで使用される var __scope_this = this; CLoader.main(); }; new __scope(); }());