当前位置: 首页>>代码示例>>PHP>>正文


PHP cachemgr::co_start方法代码示例

本文整理汇总了PHP中cachemgr::co_start方法的典型用法代码示例。如果您正苦于以下问题:PHP cachemgr::co_start方法的具体用法?PHP cachemgr::co_start怎么用?PHP cachemgr::co_start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cachemgr的用法示例。


在下文中一共展示了cachemgr::co_start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _get_goods

 function _get_goods($gid)
 {
     $render = $this->app->render();
     $objGoods = $this->app->model('goods');
     $aGoods_list = $objGoods->getList("goods_id,name,bn,brief,brand_id,type_id,unit,params,p_1,p_2,p_3,p_4,p_5,p_6,p_7,p_8,p_9,p_10,p_11,p_12,p_13,p_14,p_15,p_16,p_17,p_18,p_19,p_20,p_21,p_22,p_23,p_24,p_25,p_26,p_27,p_28,p_29,p_30,p_31,p_32,p_33,p_34,p_35,p_36,p_37,p_38,p_39,p_40,p_41,p_42,p_43,p_44,p_45,p_46,p_47,p_48,p_49,p_50", array('goods_id' => $gid));
     $aGoods['name'] = $aGoods_list[0]['name'];
     $aGoods['bn'] = $aGoods_list[0]['bn'];
     $aGoods['brief'] = $aGoods_list[0]['brief'];
     $aGoods['params'] = $aGoods_list[0]['params'];
     $goods_type = app::get("b2c")->model("goods_type");
     cachemgr::co_start();
     if (!cachemgr::get("goods_type_props_value_list2dump" . $aGoods_list[0]['type_id'], $goods_type_data)) {
         $goods_type_data = $goods_type->dump($aGoods_list[0]['type_id']);
         cachemgr::set("goods_type_props_value_list2dump" . $aGoods_list[0]['type_id'], $goods_type_data, cachemgr::co_end());
     }
     $aGoods['type'] = $goods_type_data;
     $brand_row = $goods_type->db->selectrow("select brand_id,brand_name from sdb_b2c_brand where brand_id=" . intval($aGoods_list[0]['brand_id']));
     $aGoods['brand'] = $brand_row;
     foreach ($aGoods_list[0] as $aGoods_k => $aGoods_v) {
         if (strpos($aGoods_k, "p_") === 0) {
             $aGoods['props'][$aGoods_k]['value'] = $aGoods_v;
         }
     }
     return $aGoods;
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:25,代码来源:params.php

示例2: show

 function show($gid, &$aGoods = null)
 {
     $render = $this->app->render();
     if (!$aGoods) {
         $o = kernel::single('b2c_goods_model');
         $aGoods = $o->getGoods($gid);
     }
     if (!$aGoods['images']) {
         $render->pagedata['noimage'] = 'true';
         $imageDefault = app::get('image')->getConf('image.set');
         $aGoods['images'][]['image_id'] = $imageDefault['M']['default_image'];
         $aGoods['goods']['image_default_id'] = $imageDefault['M']['default_image'];
     } else {
         $oImage = app::get('image')->model('image');
         $imageDefault = app::get('image')->getConf('image.set');
         foreach ($aGoods['images'] as $k => $v) {
             //todo 暂时cache 处理,以后优化的时候在storager中判断
             //判断是否对应的图片是否存在,不存在则用默认图片显示
             if (!cachemgr::get('goods_image' . intval($v['image_id']), $image_id)) {
                 cachemgr::co_start();
                 $image_id = $oImage->getList("image_id", array('image_id' => $v['image_id']));
                 cachemgr::set('goods_image' . intval($v['image_id']), $image_id, cachemgr::co_end());
             }
             if (!$image_id) {
                 if ($aGoods['image_default_id'] == $v['image_id']) {
                     $aGoods['image_default_id'] = $imageDefault['M']['default_image'];
                 }
                 $aGoods['images'][$k]['image_id'] = $imageDefault['M']['default_image'];
             }
         }
     }
     $render->pagedata['goods'] = $aGoods;
     return $render->fetch('site/product/goodspic.html');
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:34,代码来源:pic.php

示例3: display

 function display($tmpl_file, $app_id = null, $fetch = false, $is_theme = false)
 {
     array_unshift($this->_files, $tmpl_file);
     $this->_vars = $this->pagedata;
     if ($p = strpos($tmpl_file, ':')) {
         $object = kernel::service('tpl_source.' . substr($tmpl_file, 0, $p));
         if ($object) {
             $tmpl_file_path = substr($tmpl_file, $p + 1);
             $last_modified = $object->last_modified($tmpl_file_path);
         }
     } else {
         if (defined('CUSTOM_CORE_DIR') && file_exists(CUSTOM_CORE_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file)) {
             $tmpl_file = CUSTOM_CORE_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file;
         } else {
             if (!$is_theme) {
                 $tmpl_file = realpath(APP_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file);
             } else {
                 $tmpl_file = realpath(THEME_DIR . '/' . $tmpl_file);
             }
         }
         $last_modified = filemtime($tmpl_file);
     }
     if (!$last_modified) {
         //无文件
     }
     $this->tmpl_cachekey('__temp_lang', kernel::get_lang());
     //设置模版所属语言包
     $this->tmpl_cachekey('__temp_app_id', $app_id ? $app_id : $this->app->app_id);
     $compile_id = $this->compile_id($tmpl_file);
     #if($this->force_compile || base_kvstore::instance('cache/template')->fetch($compile_id, $compile_code, $last_modified) === false){
     if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
         if ($object) {
             $compile_code = $this->_compiler()->compile($object->get_file_contents($tmpl_file_path));
         } else {
             $compile_code = $this->_compiler()->compile_file($tmpl_file);
         }
         if ($compile_code !== false) {
             #base_kvstore::instance('cache/template')->store($compile_id,$compile_code);
             cachemgr::co_start();
             cachemgr::set($compile_id . $last_modified, $compile_code, cachemgr::co_end());
         }
     }
     ob_start();
     eval('?>' . $compile_code);
     $content = ob_get_contents();
     ob_end_clean();
     array_shift($this->_files);
     $this->pre_display($content);
     if ($fetch === true) {
         return $content;
     } else {
         echo $content;
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:54,代码来源:render.php

示例4: getListAll

 public function getListAll()
 {
     if (!cachemgr::get('member_lv_info_all', $data)) {
         cachemgr::co_start();
         $memberLvData = $this->getList('*');
         foreach ($memberLvData as $row) {
             $data[$row['member_lv_id']] = $row;
         }
         cachemgr::set('member_lv_info_all', $data, cachemgr::co_end());
     }
     return $data;
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:12,代码来源:lv.php

示例5: display

 public function display($tmpl_file, $app_id = null, $fetch = false, $is_theme = false)
 {
     array_unshift($this->_files, $tmpl_file);
     $this->_vars = $this->pagedata;
     if ($p = strpos($tmpl_file, ':')) {
         $object = vmc::service('tpl_source.' . substr($tmpl_file, 0, $p));
         if ($object) {
             $tmpl_file_path = substr($tmpl_file, $p + 1);
             $last_modified = $object->last_modified($tmpl_file_path);
         }
     } else {
         if (defined('EXTENDS_DIR') && file_exists(EXTENDS_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file)) {
             $tmpl_file = EXTENDS_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file;
         } else {
             if (!$is_theme) {
                 $tmpl_file = realpath(APP_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file);
             } else {
                 $tmpl_file = realpath(THEME_DIR . '/' . $tmpl_file);
             }
         }
         $last_modified = filemtime($tmpl_file);
     }
     if (!$last_modified) {
         trigger_error('未知VIEW', E_USER_ERROR);
     }
     $this->tmpl_cachekey('__temp_lang', vmc::get_lang());
     //设置模版所属语言包
     $this->tmpl_cachekey('__temp_app_id', $app_id ? $app_id : $this->app->app_id);
     $compile_id = $this->compile_id($tmpl_file);
     if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
         if ($object) {
             $compile_code = $this->_compiler()->compile($object->get_file_contents($tmpl_file_path));
         } else {
             $compile_code = $this->_compiler()->compile_file($tmpl_file);
         }
         if ($compile_code !== false) {
             cachemgr::co_start();
             cachemgr::set($compile_id . $last_modified, $compile_code, cachemgr::co_end());
         }
     }
     ob_start();
     eval('?>' . $compile_code);
     $content = ob_get_contents();
     ob_end_clean();
     array_shift($this->_files);
     $this->pre_display($content);
     if ($fetch === true) {
         return $content;
     } else {
         echo $content;
     }
 }
开发者ID:noikiy,项目名称:snk.com,代码行数:52,代码来源:render.php

示例6: show

 function show($gid, &$aGoods = null, $siteMember = null)
 {
     $render = $this->app->render();
     if (!$aGoods) {
         $o = kernel::single('b2c_goods_model');
         $aGoods = $o->getGoods($gid);
     }
     if ($aGoods['product']) {
         if (empty($siteMember)) {
             $siteMember = $this->app->model("members")->get_current_member();
         }
         $priceArea = array();
         if ($siteMember['member_lv']) {
             $mlv = $siteMember['member_lv'];
         } else {
             $level =& $this->app->model('member_lv');
             $mlv = $level->get_default_lv();
         }
         if ($mlv) {
             $aConfig = kernel::single('b2c_cart_prefilter_promotion_goods')->_init_rule_public(array($gid), array('member_lv' => 'false'));
             foreach ($aGoods['product'] as $gpk => &$gpv) {
                 $promotion_price = kernel::single('b2c_goods_promotion_price')->process($gpv, $aConfig);
                 $gpv['price']['price']['current_price'] = empty($promotion_price['price']) ? $gpv['price']['price']['current_price'] : $promotion_price['price'];
                 $gpv['price']['price']['price'] = empty($promotion_price['price']) ? $gpv['price']['price']['price'] : $promotion_price['price'];
                 if (is_array($gpv['price']['member_lv_price'])) {
                     foreach ($gpv['price']['member_lv_price'] as $mk => &$mv) {
                         $mv['price'] = empty($promotion_price['price']) ? $mv['price'] : $promotion_price['price'];
                     }
                 }
             }
         }
     }
     $oMlv = $this->app->model('member_lv');
     if (!cachemgr::get('member_evel_list', $mLevelList)) {
         cachemgr::co_start();
         $mLevelList = $oMlv->getList('*', '', 0, -1);
         cachemgr::set('member_evel_list', $mLevelList, cachemgr::co_end());
     }
     $render->pagedata['mLevel'] = $mLevelList;
     $render->pagedata['goods'] = $aGoods;
     return $render->fetch('site/product/mlv_price.html');
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:42,代码来源:mlvprice.php

示例7: gallery

 /**
  * 商品列表.
  */
 public function gallery($params = array())
 {
     $default_params = array('page_size' => 20, 'page_index' => 1, 'orderby' => '');
     if (!is_array($params)) {
         $params = array();
     }
     $params = array_merge($default_params, $params, $this->req_params);
     if ($params['orderby']) {
         $params['orderby'] = str_replace('-', ' ', $params['orderby']);
     }
     $cache_key = utils::array_md5($params);
     //优先从缓存读取
     if (cachemgr::get($cache_key, $gallery_data)) {
         $this->success($gallery_data);
     }
     cachemgr::co_start();
     $filter = $params['filter'];
     if (!is_array($filter)) {
         $filter = array();
     }
     $filter['marketable'] = 'true';
     $obj_goods_stage = vmc::singleton('b2c_goods_stage');
     //set_member
     if ($this->app->member_id = vmc::singleton('b2c_user_object')->get_member_id()) {
         $obj_goods_stage->set_member($this->app->member_id);
     }
     $mdl_goods = app::get('b2c')->model('goods');
     $goods_cols = 'goods_id,gid,name,type_id,cat_id,brand_id,nostore_sell,brief,image_default_id,goods_setting';
     $goods_list = $mdl_goods->getList($goods_cols, $filter, $params['page_size'] * ($params['page_index'] - 1), $params['page_size'], $params['orderby']);
     if (!$goods_list) {
         $this->failure();
     }
     $total = $mdl_goods->count($filter);
     $obj_goods_stage->gallery($goods_list);
     //引用传递
     $page_total = $total ? ceil($total / $the_params['page_size']) : 1;
     $gallery_data = array('page_total' => $page_total > 0 ? $page_total : 1, 'goods_list' => array_values($goods_list));
     cachemgr::set($cache_key, $gallery_data, cachemgr::co_end());
     $this->success($gallery_data);
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:43,代码来源:goods.php

示例8: _list

 private function _list($filter, $page, $orderby)
 {
     $cache_key = utils::array_md5(func_get_args());
     if (cachemgr::get($cache_key, $return)) {
         return $return;
     }
     cachemgr::co_start();
     $goods_cols = '*';
     $mdl_goods = $this->app->model('goods');
     $goods_list = $mdl_goods->getList($goods_cols, $filter, $page['size'] * ($page['index'] - 1), $page['size'], $orderby);
     $obj_goods_stage = vmc::singleton('b2c_goods_stage');
     //set_member
     if ($this->app->member_id = vmc::singleton('b2c_user_object')->get_member_id()) {
         $obj_goods_stage->set_member($this->app->member_id);
     }
     $obj_goods_stage->gallery($goods_list);
     //引用传递
     $total = $mdl_goods->count($filter);
     $return = array('data' => $goods_list, 'count' => count($goods_list), 'all_count' => $total, 'page_info' => array('total' => $total ? ceil($total / $page['size']) : 1, 'current' => intval($page['index'])));
     cachemgr::set($cache_key, $return, cachemgr::co_end());
     return $return;
 }
开发者ID:noikiy,项目名称:msk.com,代码行数:22,代码来源:list.php

示例9: dispatch

 public function dispatch($query)
 {
     $this->check_blacklist();
     //黑名单检测
     $page_starttime = $this->microtime_float();
     /** 影响性能暂时去掉
         	foreach(kernel::servicelist('site.router.predispatch') as $obj)	{
     			$query = $obj->router_predispatch($query);
             **/
     $this->init_query_info($query);
     $this->init_request_info();
     $this->check_https();
     $this->check_expanded_name();
     $router_cache_options = $this->check_router_cache();
     $page_key = 'SITE_PAGE_CACHE:' . $this->_request->get_request_uri();
     logger::debug('page: ' . $this->_request->get_request_uri());
     if (!$this->is_need_cache() || $this->is_need_cache() && !cachemgr::get($page_key, $page, $router_cache_options['skipvary'])) {
         if (WITHOUT_CACHE !== true) {
             logger::info('page cache miss:' . $this->_request->get_request_uri());
         }
         cachemgr::co_start();
         $this->default_dispatch();
         $page['html'] = join("\n", $this->_response->get_bodys());
         $page['date'] = date("Y-m-d H:i:s");
         $page['times'] = sprintf('%0.2f', $this->microtime_float() - $page_starttime);
         if ($this->is_need_cache() && $this->_response->get_http_response_code() == 200 && $this->has_page_cache_control() === true) {
             $page_cache = true;
             $this->_response->set_header('X-Cache', 'HIT from ecos-pagecache ' . $page['date']);
             //todo:记录x-cache
             $page['headers'] = $this->_response->get_headers();
             $page['raw_headers'] = $this->_response->get_raw_headers();
             $page['etag'] = md5($page['html']);
             $cache_options = cachemgr::co_end();
             if ($router_cache_options['expires']) {
                 $cache_options['expires'] = $cache_options['expires'] && $cache_options['expires'] < $router_cache_options['expires'] ? $cache_options['expires'] : $router_cache_options['expires'];
             }
             $cache_options['expires'] = $cache_options['expires'] > time() ? $cache_options['expires'] : 0;
             //$cache_options['skip_vary'] = $cache_expires;
             cachemgr::set($page_key, $page, $cache_options);
         } else {
             $page_cache = false;
             cachemgr::co_end();
         }
     } else {
         $page_cache = true;
         $this->_response->clean_headers();
         if (isset($page['headers'])) {
             foreach ($page['headers'] as $header) {
                 $this->_response->set_header($header['name'], $header['value'], $header['replace']);
             }
         }
         if (isset($page['raw_headers'])) {
             foreach ($page['raw_headers'] as $raw_header) {
                 $this->_response->set_raw_headers($raw_header);
             }
         }
         if (WITHOUT_CACHE !== true) {
             logger::info('page cache hit:' . $this->_request->get_request_uri());
         }
     }
     if ($page_cache === true) {
         $etag = $page['etag'] ? $page['etag'] : md5($page['html']);
         //todo: 兼容
         $this->_response->set_header('Etag', $etag);
         $matchs = explode(',', $_ENV['HTTP_IF_NONE_MATCH']);
         foreach ($matchs as $match) {
             if (trim($match) == $etag) {
                 $this->_response->clean_headers();
                 $this->_response->set_header('Content-length', '0');
                 $this->_response->set_http_response_code(304)->send_headers();
                 exit;
             }
         }
     }
     $this->set_vary_cookie();
     $this->_response->send_headers();
     echo $page['html'];
     logger::debug('This page created by ' . $page['date']);
     logger::debug('Mysql queries count:' . base_db_connections::$mysql_query_executions);
     logger::debug('Kvstore queries count:' . base_kvstore::$__fetch_count);
     logger::debug('Page Times: ' . $page['times']);
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:82,代码来源:router.php

示例10: goodsDetailIntro

 function goodsDetailIntro($gid)
 {
     $this->_response->set_header('Cache-Control', 'no-store, no-cache');
     if (!cachemgr::get('ajax_product_wap_detail_intro' . $gid, $intro_html)) {
         cachemgr::co_start();
         $objGoods = $this->app->model('goods');
         $aGoods_list = $objGoods->getList("intro,wapintro", array('goods_id' => $gid));
         $intro = !empty($aGoods_list[0]['wapintro']) ? $aGoods_list[0]['wapintro'] : $aGoods_list[0]['intro'];
         $this->pagedata['intro'] = $intro;
         $intro_html = $this->fetch('wap/product/tab/detail_intro.html');
         cachemgr::set('ajax_product_wap_detail_intro' . $gid, $intro_html, cachemgr::co_end());
     }
     echo $intro_html;
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:14,代码来源:product.php

示例11: display_tmpl

 public final function display_tmpl($tmpl, $fetch = false, $is_preview = false)
 {
     array_unshift($this->_files, $this->get_theme() . '/' . $tmpl);
     $this->_vars = $this->pagedata;
     $tmpl_file = realpath(WAP_THEME_DIR . '/' . $this->get_theme() . '/' . $tmpl);
     $this->tmpl_cachekey('__theme_app_id', $this->get_tmpl_main_app_id() ? $this->get_tmpl_main_app_id() : $this->app->app_id);
     $this->tmpl_cachekey('__theme_main_page', $this->pagedata['_MAIN_']);
     $compile_id = $this->compile_id($this->get_theme() . "/" . $tmpl);
     $last_modified = filemtime($tmpl_file);
     if (!$is_preview) {
         if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
             cachemgr::co_start();
             $tmpl_content = kernel::single('wap_theme_file')->get_tmpl_content($this->get_theme(), $tmpl);
             $compile_code = $this->_compiler()->compile($tmpl_content);
             if ($compile_code !== false) {
                 $compile_code = $this->fix_theme_media($compile_code);
             }
             cachemgr::set($compile_id . $last_modified, $compile_code, cachemgr::co_end());
         }
     } else {
         $this->_compiler()->is_preview = $is_preview;
         $tmpl_content = kernel::single('wap_theme_file')->get_tmpl_content($this->get_theme(), $tmpl);
         $compile_code = $this->_compiler()->compile($tmpl_content);
         if ($compile_code !== false) {
             $compile_code = $this->fix_theme_media($compile_code);
         }
     }
     kernel::single('wap_theme_base')->get_theme_cache_version($this->get_theme());
     /** 添加theme_url的值 **/
     $theme_url = kernel::base_url(1) . '/wap_themes';
     ob_start();
     eval('?>' . $compile_code);
     $content = ob_get_contents();
     ob_end_clean();
     array_shift($this->_files);
     $this->pre_display($content);
     if ($fetch === true) {
         return $content;
     } else {
         echo $content;
     }
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:42,代码来源:controller.php

示例12: index

 public function index($cat_id = '', $urlFilter = null, $orderBy = 0, $tab = null, $page = 1, $cat_type = null, $view = null)
 {
     $tab = intval($tab);
     $urlFilter = $this->RemoveXSS($urlFilter);
     // 20130204 Andrew 俱乐部专区功能,俱乐部专区只能俱乐部访问
     $goods_cat = $this->app->model('goods_cat')->dump($cat_id);
     if ($goods_cat['cat_name'] == '俱乐部专区') {
         $custom_user = kernel::single('custom_member')->get_custom_user(helper::current_account_id());
         if ((!$custom_user['club'] || !$custom_user['vip']) && !$custom_user['leader']) {
             $back_url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site', 'act' => 'index'));
             $this->splash('failed', $back_url, app::get('b2c')->_('本页需要认证俱乐部才能进入'));
         }
     }
     // 20130204 End
     $urlFilter = htmlspecialchars(urldecode($urlFilter));
     $_GET['scontent'] = htmlspecialchars($_GET['scontent']);
     if (!empty($urlFilter) && $urlFilter != $_GET['scontent']) {
         $urlFilter .= '_' . $_GET['scontent'];
     } else {
         $urlFilter = $_GET['scontent'];
     }
     $virCatObj =& $this->app->model('goods_virtual_cat');
     if ($cat_type) {
         $vcatid = $cat_type;
         $oSearch =& $this->app->model('search');
         /** 颗粒缓存商品虚拟分类 **/
         if (!cachemgr::get('goods_virtual_cat_' . intval($vcatid), $vcat)) {
             cachemgr::co_start();
             $vcat = $virCatObj->getList('cat_id,cat_path,virtual_cat_id,filter,virtual_cat_name as cat_name', array('virtual_cat_id' => intval($vcatid)));
             cachemgr::set('goods_virtual_cat_' . intval($vcatid), $vcat, cachemgr::co_end());
         }
         $vcat = current($vcat);
         $vcatFilters = $virCatObj->_mkFilter($vcat['filter']);
         $vcatFilters = $virCatObj->getFilter($vcatFilters);
         $old_cat_id = $cat_id;
         $old_urlFilter = $urlFilter;
         $cat_id = $cat_id ? $cat_id . implode(",", $vcatFilters['cat_id']) : implode(",", $vcatFilters['cat_id']);
         $urlFilter = $urlFilter ? $urlFilter : $oSearch->encode($vcatFilters);
     }
     $page = $page > 1 ? intval($page) : 1;
     if ($cat_id == '_ANY_') {
         unset($cat_id);
     }
     if ($cat_id) {
         $cat_id = explode(",", $cat_id);
         foreach ($cat_id as $k => $v) {
             if ($v) {
                 $cat_id[$k] = intval($v);
             }
         }
         $this->id = implode(",", $cat_id);
     } else {
         $cat_id = array('');
         $this->id = '';
     }
     $pageLimit = $this->app->getConf('gallery.display.listnum');
     $pageLimit = $pageLimit ? $pageLimit : 20;
     $this->pagedata['pdtPic'] = array('width' => 100, 'heigth' => 100);
     $productCat =& $this->app->model('goods_cat');
     $objGoods = $this->app->model('goods');
     $global_runtime_path = "";
     // ajx 这里添加对分类的判断,当分类不存在时不做缓存处理
     if (!cachemgr::get('global_runtime_path' . $this->id, $global_runtime_path)) {
         cachemgr::co_start();
         if ($cat_type) {
             $global_runtime_path = $virCatObj->getPath($cat_type, '');
         } else {
             $global_runtime_path = $productCat->getPath($cat_id[0], '');
         }
         cachemgr::set('global_runtime_path', $global_runtime_path, cachemgr::co_end());
     }
     /****ajx 以下是为了当搜索条件存在时 面包屑中显示 搜索条件 ***/
     if ($_GET['scontent'] && strlen($urlFilter) > 0) {
         $global_runtime_path = array(array('type' => 'goodsCat', 'title' => app::get('site')->_('首页'), 'link' => kernel::base_url(1)));
         $title_ = explode('_', $urlFilter);
         $title_arr = "";
         foreach ($title_ as $val_xin) {
             $title_xin = explode(',', $val_xin);
             if (count($title_xin) > 2) {
                 unset($title_xin[0]);
                 foreach ($title_xin as $xin_val) {
                     $title_arr[] = $xin_val;
                 }
             } else {
                 $title_arr[] = $title_xin[1];
             }
         }
         $title = implode(',', $title_arr);
         array_push($global_runtime_path, array('type' => 'goodsCat', 'title' => app::get('site')->_($title), 'link' => kernel::base_url(1)));
     }
     // ajx 以下是为了当无分类和搜索条件时 显示所有商品
     if (count($global_runtime_path) < 2) {
         $global_runtime_path = array(array('type' => 'goodsCat', 'title' => app::get('site')->_('首页'), 'link' => kernel::base_url(1)), array('type' => 'goodsCat', 'title' => app::get('site')->_('所有商品'), 'link' => kernel::base_url(1)));
     }
     $GLOBALS['runtime']['path'] = $global_runtime_path;
     if ($cat_id[0]) {
         if (!cachemgr::get('goods_cat_' . $cat_id[0], $this->cat_result)) {
             cachemgr::co_start();
             $this->cat_result = $productCat->getList('cat_name,gallery_setting,type_id', array('cat_id|in' => $cat_id), 0, 1);
             cachemgr::set('goods_cat_' . $cat_id[0], $this->cat_result, cachemgr::co_end());
//.........这里部分代码省略.........
开发者ID:syjzwjj,项目名称:quyeba,代码行数:101,代码来源:gallery+copy.php

示例13: dispatch

 public function dispatch($query)
 {
     $this->check_blacklist();
     //黑名单检测
     $page_starttime = $this->microtime_float();
     $this->init_query_info($query);
     $this->init_request_info();
     $this->check_https();
     $this->check_expanded_name();
     $router_cache_options = $this->check_router_cache();
     $page_key = 'SITE_PAGE_CACHE:' . $this->_request->get_request_uri();
     if (!$this->is_need_cache() || $this->is_need_cache() && !cachemgr::get($page_key, $page, $router_cache_options['skipvary'])) {
         $cache_log = 'cache missed on ' . date('Y-m-d H:i:s');
         logger::info($cache_log . ',URL:' . $this->_request->get_request_uri());
         $this->_response->set_header('X-Page-Cache', $cache_log, true);
         cachemgr::co_start();
         $this->default_dispatch();
         //执行控制器
         $page['html'] = implode("\n", $this->_response->get_bodys());
         $page['date'] = date('Y-m-d H:i:s');
         $page['times'] = sprintf('%0.2f', $this->microtime_float() - $page_starttime);
         if ($this->is_need_cache() && $this->_response->get_http_response_code() == 200 && $this->has_page_cache_control() === true) {
             $page_cache = true;
             $cache_log = 'cache refreshed on ' . $page['date'] . ',page speed:' . $page['times'];
             //logger::info($cache_log.',URL:'. $this->_request->get_request_uri());
             $this->_response->set_header('X-Page-Cache', $cache_log, true);
             $page['headers'] = $this->_response->get_headers();
             $page['raw_headers'] = $this->_response->get_raw_headers();
             $page['etag'] = md5($page['html']);
             $cache_options = cachemgr::co_end();
             if ($router_cache_options['expires']) {
                 $cache_options['expires'] = $cache_options['expires'] && $cache_options['expires'] < $router_cache_options['expires'] ? $cache_options['expires'] : $router_cache_options['expires'];
             }
             $cache_options['expires'] = $cache_options['expires'] > time() ? $cache_options['expires'] : 0;
             cachemgr::set($page_key, $page, $cache_options);
         } else {
             $page_cache = false;
             cachemgr::co_end();
         }
     } else {
         $page_cache = true;
         $this->_response->clean_headers();
         if (isset($page['headers'])) {
             foreach ($page['headers'] as $header) {
                 $this->_response->set_header($header['name'], $header['value'], $header['replace']);
             }
         }
         if (isset($page['raw_headers'])) {
             foreach ($page['raw_headers'] as $raw_header) {
                 $this->_response->set_raw_headers($raw_header);
             }
         }
         $cache_log = 'cache hit on ' . $page['date'] . ',page speed:' . $page['times'];
         //logger::info($cache_log.',URL:'. $this->_request->get_request_uri());
         $this->_response->set_header('X-Page-Cache', $cache_log, true);
     }
     if ($page_cache === true) {
         $etag = $page['etag'] ? $page['etag'] : md5($page['html']);
         //todo: 兼容
         $this->_response->set_header('Etag', $etag);
         $matchs = explode(',', $_ENV['HTTP_IF_NONE_MATCH']);
         foreach ($matchs as $match) {
             if (trim($match) == $etag) {
                 $this->_response->clean_headers();
                 $this->_response->set_header('Content-length', '0');
                 $this->_response->set_http_response_code(304)->send_headers();
                 exit;
             }
         }
     }
     $this->set_vary_cookie();
     $this->_response->send_headers();
     echo $page['html'];
     logger::debug('This page created by ' . $page['date']);
     logger::debug('Kvstore queries count:' . base_kvstore::$__fetch_count);
     logger::debug('Page speed: ' . $page['times']);
 }
开发者ID:noikiy,项目名称:snk,代码行数:77,代码来源:router.php

示例14: get_goods_brand

 public function get_goods_brand($goodsId, $goodsInfo = array())
 {
     if (empty($goodsInfo)) {
         $goodsInfo = $this->goodsModel->getList('brand_id', array('goods_id' => $goodsId));
         $goodsInfo = $goodsInfo[0];
     }
     if (!empty($goodsInfo['brand_id'])) {
         cachemgr::co_start();
         if (!cachemgr::get("goodsObjectBrand" . $goodsInfo['brand_id'], $goodsInfoBrand)) {
             $goodsInfoBrand = app::get("b2c")->model("brand")->getList('*', array('brand_id' => $goodsInfo['brand_id']));
             $goodsInfoBrand = $goodsInfoBrand[0];
             cachemgr::set("goodsObjectBrand" . $goodsInfo['brand_id'], $goodsInfoBrand, cachemgr::co_end());
         }
     }
     return $goodsInfoBrand;
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:16,代码来源:object.php

示例15: ajax_product_basic

 function ajax_product_basic($product_id)
 {
     $sql = "select * from sdb_starbuy_special_goods WHERE product_id = '{$product_id}' AND status = 'true'";
     $huodong = kernel::database()->select($sql);
     $gguo = '';
     if ($huodong) {
         $gguo = $huodong[0]['limit'];
     }
     $this->pagedata['xiangou_one'] = $gguo;
     $this->_response->set_header('Cache-Control', 'no-store, no-cache');
     if (!cachemgr::get('ajax_product_basic' . $product_id, $basic_html)) {
         cachemgr::co_start();
         $product = app::get('b2c')->model('products')->getList('*', array('product_id' => $product_id));
         if (!$product) {
             echo json_encode(array('error' => app::get('b2c')->_('商品不存在')));
             return;
         }
         if ($object_price = kernel::service('special_goods')) {
             $app_name = $object_price->ifSpecial($product_id);
             $this->pagedata['app_name'] = $app_name ? $app_name : "";
         }
         $aGoods = app::get('b2c')->model('goods')->getList('*', array('goods_id' => $product[0]['goods_id']));
         $aGoods = $aGoods[0];
         $aGoods['product'] = $product[0];
         $userObject = kernel::single('b2c_user_object');
         $siteMember = $userObject->get_current_member();
         if (empty($siteMember['member_id'])) {
             $this->pagedata['login'] = 'nologin';
             $member_id = '-1';
         } else {
             $member_id = $siteMember['member_id'];
             $member_lv = $siteMember['member_lv'];
             $this->pagedata['member_info'] = $siteMember;
             $this->pagedata['this_member_lv_id'] = $member_lv;
         }
         $goodsId = $aGoods['goods_id'];
         $setting = $this->_get_goods_setting($goodsId);
         $this->pagedata['setting'] = $setting;
         $productBasic = $this->_get_product_basic($product_id, $aGoods, $siteMember);
         $gfav = explode(',', $_COOKIE['S']['GFAV'][$siteMember['member_id']]);
         if (in_array($aGoods['goods_id'], $gfav)) {
             $productBasic['is_fav'] = true;
         }
         //btn
         $this->pagedata['btn_page_list'] = $this->_get_servicelist_by('b2c_products_index_btn');
         $this->pagedata['page_product_basic'] = $productBasic;
         //社会化分享
         $goodsshare = kernel::single('b2c_goods_share')->get_share($productBasic);
         $this->pagedata['goods_share'] = $goodsshare;
         /**** start 商品评分 ****/
         $objPoint = $this->app->model('comment_goods_point');
         $this->pagedata['goods_point'] = $objPoint->get_single_point($goodsId);
         $this->pagedata['total_point_nums'] = $objPoint->get_point_nums($goodsId);
         /**** end 商品评分 ****/
         $basic_html = $this->fetch('site/product/basic.html');
         cachemgr::set('ajax_product_basic' . $product_id, $basic_html, cachemgr::co_end());
     }
     echo $basic_html;
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:59,代码来源:product.php


注:本文中的cachemgr::co_start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。