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


PHP cachemgr::set_expiration方法代码示例

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


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

示例1: theme_widget_articles

/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
function theme_widget_articles(&$setting, &$smarty)
{
    $setting['order'] or $setting['order'] = 'desc';
    $setting['order_type'] or $setting['order_type'] = 'pubtime';
    $func = array('asc' => 'ksort', 'desc' => 'krsort');
    $mdl_memberLv = app::get('b2c')->model('member_lv');
    $default_member_lv = $mdl_memberLv->dump(array('default_lv' => '1'), 'member_lv_id');
    $member_level = $default_member_lv['member_lv_id'];
    //默认等级
    $obj_members = app::get('b2c')->model('members');
    $memberTmp = $obj_members->get_current_member();
    $member_type = '1';
    if (isset($memberTmp['member_lv'])) {
        $member_level = $memberTmp['member_lv'];
        $member_type = $memberTmp['member_type'];
    }
    //$member_type  = '2';
    $oAN = kernel::single("content_article_node");
    $oMAI = app::get('content')->model('article_indexs');
    $objrequest = kernel::single("base_component_request");
    $article_id = $objrequest->get_param(0);
    if (isset($setting['upto_articleid']) && $setting['upto_articleid'] == "1" && $article_id > 0) {
        //获取父节点id
        $nodeinfo = $oMAI->getList("node_id", array("article_id" => $article_id));
        $iNodeId = $nodeinfo[0]['node_id'];
    }
    if (!$iNodeId) {
        $iNodeId = $setting['node_id'];
    }
    $lv = $setting['lv'];
    $limit = $setting['limit'];
    $tmp = $oAN->get_node($iNodeId, false, $member_type);
    article_foost($lv, $iNodeId, $limit, $setting['showallart'], $oAN, $oMAI, $tmp['child'], $setting, $member_type);
    //error_log(var_export($tmp,true),3,DATA_DIR.'/pansen.dd.txt');
    $html = array();
    article_showst($smarty, $tmp['child'], $setting, $html, 0, $limit);
    if (!$setting['shownode']) {
        $func[$setting['order']]($html);
    }
    $html = implode(' ', $html);
    $filter = array();
    $filter['ifpub'] = 'true';
    $filter['pubtime|than'] = time();
    $arr = $oMAI->getList('pubtime', $filter, 0, 1, ' pubtime ASC');
    if ($arr) {
        //设置缓存过期时间
        reset($arr);
        $arr = current($arr);
        cachemgr::set_expiration($arr['pubtime']);
    }
    $tmp['__html'] = $html;
    $tmp['__shownode'] = $setting['shownode'];
    $tmp['__stripparenturl'] = $setting['stripparenturl'];
    if ($tmp['homepage'] == 'true') {
        $tmp['node_url'] = app::get('site')->router()->gen_url(array('app' => 'content', 'ctl' => 'site_article', 'act' => 'nodeindex', 'arg0' => $setting['node_id']));
    } else {
        $tmp['node_url'] = app::get('site')->router()->gen_url(array('app' => 'content', 'ctl' => 'site_article', 'act' => 'lists', 'arg0' => $setting['node_id']));
    }
    return $tmp;
}
开发者ID:syjzwjj,项目名称:quyeba,代码行数:66,代码来源:theme_widget_articles.php

示例2: set_page_data

 public function set_page_data($gid, $object)
 {
     $enable = app::get('site')->model('modules')->getList('enable', array('app' => 'groupactivity'));
     foreach ($enable as $v) {
         $able = $v['enable'];
     }
     $object->pagedata['enable'] = $able;
     $object->pagedata['purchase'] = $arr = kernel::single("groupactivity_purchase")->_get_dump_data($gid);
     if ($arr) {
         if ($arr['act_open'] == 'false' || $arr['max_buy'] <= $arr['buy'] && $arr['max_buy'] != 0) {
             $object->pagedata['purchase'] = null;
         }
         $object->pagedata['group_url'] = app::get('site')->router()->gen_url(array('app' => 'groupactivity', 'ctl' => 'site_cart', 'act' => 'index', 'arg0' => $arr['act_id']));
         cachemgr::set_expiration($arr['end_time']);
     }
     #$this->_response->set_header('Cache-Control', 'no-store');
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:17,代码来源:purchase.php

示例3: index

 function index()
 {
     $get = $this->_request->get_params();
     $pid = intval($get[0]);
     #活动类型
     $stype_id = $get[1];
     $this->pagedata['imageDefault'] = app::get('image')->getConf('image.set');
     $GLOBALS['runtime']['path'] = $this->runtime_path($stype_id, $pid);
     $special_goods = $this->mdl_special_goods->getRow('*', array('product_id' => $pid));
     $goodsdata = $this->special_pro->getdetailParams($special_goods);
     //没有默认货品图片则显示商品所有图片,否则显示关联货品图片
     if (empty($goodsdata['images'])) {
         $goodsImages = $this->_get_goods_image($goodsdata['goods']['goods_id']);
         $productBasic['images'] = $goodsImages;
         //商品图片
         $productBasic['image_default_id'] = $goodsdata['goods']['image_default_id'];
         //商品图片
     } else {
         $productBasic['images'] = $goodsdata['images'];
         $productBasic['image_default_id'] = $goodsdata['images'][0]['image_id'];
         //商品图片
     }
     $this->pagedata['page_product_basic'] = $productBasic;
     $this->pagedata['goodsdata'] = $goodsdata;
     $this->pagedata['stypeid'] = $stype_id;
     $this->pagedata['member_id'] = $this->userObject->get_member_id() ? $this->userObject->get_member_id() : 0;
     $this->pagedata['nowtime'] = time();
     //社会化分享
     $goodsshare = kernel::single('b2c_goods_share')->get_share($productBasic);
     $this->pagedata['goods_share'] = $goodsshare;
     //是否开启商品推荐
     $setting['recommend'] = app::get('b2c')->getConf('goods.recommend');
     $this->pagedata['setting'] = $setting;
     //已发布未开始页面缓存
     if ($this->pagedata['nowtime'] >= $goodsdata['release_time'] && $this->pagedata['nowtime'] < $goodsdata['begin_time']) {
         //活动开始的时候缓存过期
         cachemgr::set_expiration($goodsdata['begin_time']);
     } elseif ($this->pagedata['nowtime'] >= $goodsdata['begin_time'] && $this->pagedata['nowtime'] < $goodsdata['end_time']) {
         //活动结束的时候缓存过期
         cachemgr::set_expiration($goodsdata['end_time']);
     }
     $this->page('site/product/index.html');
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:43,代码来源:team.php

示例4: theme_widget_index_news

/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */

function theme_widget_index_news(&$setting,&$smarty){
    $setting['order'] or $setting['order'] = 'desc';
    $setting['order_type'] or $setting['order_type'] = 'pubtime';
    $func = array('asc'=>'ksort','desc'=>'krsort');

    $oAN = kernel::single("content_article_node");
    $oMAI = app::get('content')->model('article_indexs');
    $iNodeId = $setting['node_id'];
    $lv = $setting['lv'];
    $limit = $setting['limit'];
    $tmp = $oAN->get_node($iNodeId, true);
    article_new_foo($lv, $iNodeId, $limit, $setting['showallart'], $oAN, $oMAI, $tmp['child'], $setting);
    $html = array();

    article_new_show($smarty, $tmp['child'], $setting, $html, 0, $limit);
    if( !$setting['shownode'] ) {
        $func[$setting['order']]($html);
    }
    $html = implode(' ',$html);
    $filter = array();
    $filter['ifpub'] = 'true';
    $filter['pubtime|than'] = time();
    $arr = $oMAI->getList( 'pubtime',$filter,0,1,' pubtime ASC' );
    if( $arr ) { //设置缓存过期时间
        reset( $arr );
        $arr = current($arr);
        cachemgr::set_expiration($arr['pubtime']);
    }

    $tmp['__html'] = $html;
    $tmp['__shownode'] = $setting['shownode'];
    $tmp['__stripparenturl'] = $setting['stripparenturl'];

    if( $tmp['homepage']=='true' ) 
        $tmp['node_url'] = app::get('site')->router()->gen_url( array('app'=>'content', 'ctl'=>'site_article', 'act'=>'i', 'arg0'=>$setting['node_id']) );
    else 
        $tmp['node_url'] = app::get('site')->router()->gen_url( array('app'=>'content', 'ctl'=>'site_article', 'act'=>'l', 'arg0'=>$setting['node_id']) );
    return $tmp;
}
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:46,代码来源:theme_widget_index_news.php

示例5: lists

 /**
  * 展示特定类型的文章列表
  * @access public
  */
 public function lists()
 {
     $this->begin($this->gen_url(array('app' => 'welcome', 'ctl' => 'index')));
     $info_list_id = $this->_request->get_param(0);
     if (empty($info_list_id)) {
         $this->end(false, app::get('cps')->_('访问出错'));
     }
     $filter = array('i_type' => $info_list_id);
     //每页条数
     $pageLimit = $this->app->getConf('gallery.display.listnum');
     $pageLimit = $pageLimit ? $pageLimit : 10;
     //当前页
     $page = (int) $this->_request->get_param(1);
     $page or $page = 1;
     $filter['ifpub'] = 'true';
     $filter['pubtime|sthan'] = time();
     $infoObj = $this->app->model('info');
     //总数
     $count = $infoObj->count($filter);
     $arr_infos = $infoObj->getInfoList('*', $filter, $pageLimit * ($page - 1), $pageLimit, 'pubtime DESC');
     //标识用于生成url
     $token = md5("page{$page}");
     $this->pagedata['pager'] = array('current' => $page, 'total' => ceil($count / $pageLimit), 'link' => $this->gen_url(array('app' => 'cps', 'ctl' => 'site_info', 'act' => 'lists', 'arg0' => $info_list_id, 'arg2' => $token)), 'token' => $token);
     $filter = array();
     $filter['ifpub'] = 'true';
     $filter['pubtime|than'] = time();
     $arr = $infoObj->getInfoList('pubtime', $filter, 0, 1, ' pubtime ASC');
     if ($arr) {
         //设置缓存过期时间
         reset($arr);
         $arr = current($arr);
         cachemgr::set_expiration($arr['pubtime']);
     }
     $this->pagedata['info_type'] = $info_list_id;
     $this->pagedata['infos'] = $arr_infos;
     $this->set_tmpl('cps_common');
     $this->page('site/notice/list.html');
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:42,代码来源:info.php

示例6: index

 function index()
 {
     #$this->_response->set_header('Cache-Control','no-store');
     $params = $this->_request->get_params(true);
     $id = $params[0];
     if (!$id) {
         $this->begin();
         $this->end(false, '活动不存在!');
     }
     $o = $this->app->model('purchase');
     $arr = $o->getList('*', array('act_id' => $id));
     $arr = $arr[0];
     if (!$arr) {
         $this->begin();
         $this->end(false, '该活动不存在!');
     }
     if (!$o->validate($arr)) {
         $this->begin();
         $this->end(false, '该活动没有开启!');
     }
     //缓存过期时间 start
     $cache_time = time() > $arr['start_time'] ? time() < $arr['end_time'] ? $arr['end_time'] : false : $arr['start_time'];
     if ($cache_time) {
         cachemgr::set_expiration($cache_time);
     }
     //end
     $o->update_state($arr);
     $arr['buy'] = $arr['buy'] + $arr['start_value'];
     $this->pagedata['purchase'] = $arr;
     $productsModel = app::get('b2c')->model('products');
     $itemProduct = $productsModel->getList('*', array('product_id' => $arr['pid']));
     $arr['gid'] = $itemProduct[0]['goods_id'];
     $this->init_goods_html($arr['gid']);
     $this->pagedata['goods']['product_id'] = $arr['pid'];
     $this->pagedata['goods']['goods_id'] = $arr['gid'];
     $imageDefault = app::get('image')->getConf('image.set');
     $this->pagedata['goods']['pic_width'] = $imageDefault['M']['width'];
     $this->pagedata['goods']['pic_height'] = $imageDefault['M']['height'];
     $this->pagedata['goods']['margin_right'] = $imageDefault['M']['width'] + 8;
     if ((int) $this->pagedata['goods']['price']) {
         $this->pagedata['sales'] = round($arr['price'] / $this->pagedata['goods']['price'], 2) * 10;
     } else {
         $this->pagedata['sales'] = 0;
     }
     $this->pagedata['check_url'] = $this->gen_url(array('app' => 'groupactivity', 'ctl' => 'site_cart', 'act' => 'get_group_info', 'arg0' => $arr['act_id']));
     $this->pagedata['jump_to_cart_url'] = $this->gen_url(array('app' => 'groupactivity', 'ctl' => 'site_cart', 'act' => 'checkout'));
     //系统当前时间
     $this->pagedata['request_time_now'] = $this->gen_url(array('app' => 'groupactivity', 'ctl' => 'site_cart', 'act' => 'request_time_now'));
     $aPath = array(array('link' => 'true', 'title' => '团购:' . $arr['name']));
     $GLOBALS['runtime']['path'] = $aPath;
     $this->pagedata['body_page_list'] = $this->_get_servicelist_by('b2c_products_index_body');
     /**** begin 商品评论 ****/
     $objGoods = app::get('b2c')->model('goods');
     $objComment = kernel::single('b2c_message_disask');
     $aComment = $objComment->good_all_disask($arr['gid']);
     /**** begin 相关商品 ****/
     $oImage = app::get('image')->model('image');
     $imageDefault = app::get('image')->getConf('image.set');
     $aLinkId['goods_id'] = array();
     foreach ($objGoods->getLinkList($arr['gid']) as $rows) {
         if ($rows['goods_1'] == $arr['gid']) {
             $aLinkId['goods_id'][] = $rows['goods_2'];
         } else {
             $aLinkId['goods_id'][] = $rows['goods_1'];
         }
     }
     if (count($aLinkId['goods_id']) > 0) {
         $aLinkId['marketable'] = 'true';
         $this->pagedata['goods']['link'] = $objGoods->getList('*', $aLinkId, 0, 500);
         $this->pagedata['goods']['link_count'] = count($aLinkId['goods_id']);
     }
     $oGoodsLv = app::get('b2c')->model('goods_lv_price');
     $oMlv = app::get('b2c')->model('member_lv');
     $mlv = $oMlv->db_dump($this->site_member_lv_id, 'dis_count');
     $objProduct = app::get('b2c')->model('products');
     $siteMember = kernel::single('b2c_frontpage')->get_current_member();
     $site_member_lv_id = $siteMember['member_lv'];
     if (is_array($this->pagedata['goods']['link'])) {
         foreach ($this->pagedata['goods']['link'] as $key => &$val) {
             if ($val['udfimg'] == 'true') {
                 if (!$oImage->getList("image_id", array('image_id' => $val['thumbnail_pic']))) {
                     $val['thumbnail_pic'] = $imageDefault['S']['default_image'];
                 }
             } else {
                 if (!$oImage->getList("image_id", array('image_id' => $val['image_default_id']))) {
                     $val['image_default_id'] = $imageDefault['S']['default_image'];
                 }
             }
             $temp = $objProduct->getList('product_id, spec_info, price, freez, store,   marketable, goods_id', array('goods_id' => $val['goods_id'], 'marketable' => 'true'));
             if ($site_member_lv_id) {
                 $tmpGoods = array();
                 foreach ($oGoodsLv->getList('product_id,price', array('goods_id' => $val['goods_id'], 'level_id' => $site_member_lv_id)) as $k => $v) {
                     $tmpGoods[$v['product_id']] = $v['price'];
                 }
                 foreach ($temp as &$tv) {
                     $tv['price'] = isset($tmpGoods[$tv['product_id']]) ? $tmpGoods[$tv['product_id']] : $mlv['dis_count'] * $tv['price'];
                 }
                 $val['price'] = $tv['price'];
             }
             $promotion_price = kernel::single('b2c_goods_promotion_price')->process($val);
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:101,代码来源:cart.php

示例7: l

 public function l()
 {
     $nav_url = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : $this->gen_url(array('app' => 'wap', 'ctl' => 'default', 'act' => 'index'));
     $this->begin($nav_url);
     $art_list_id = $this->_request->get_param(0);
     if (empty($art_list_id)) {
         $this->end(false, app::get('content')->_('访问出错'));
     }
     $oCAN = kernel::single('content_article_node');
     $aPath = $oCAN->get_node_path($art_list_id, true);
     $info = $oCAN->get_node($art_list_id, true);
     if ($info['ifpub'] != 'true') {
         $this->end(false, app::get('content')->_('未发布!错误访问!'));
     }
     $GLOBALS['runtime']['path'] = $aPath;
     //title keywords description
     $this->get_seo_info($info, $aPath);
     $filter = array('node_id' => $art_list_id);
     //每页条数
     $pageLimit = $this->app->getConf('gallery.display.listnum');
     $pageLimit = $pageLimit ? $pageLimit : 10;
     //当前页
     $page = (int) $this->_request->get_param(1);
     $page or $page = 1;
     $filter['ifpub'] = 'true';
     $filter['platform'] = 'wap';
     $filter['pubtime|sthan'] = time();
     $indexsObj = $this->app->model('article_indexs');
     $bodysObj = $this->app->model('article_bodys');
     //总数
     $count = $indexsObj->count($filter);
     $arr_articles = $indexsObj->getList('*', $filter, $pageLimit * ($page - 1), $pageLimit, 'pubtime DESC');
     $article_ids = array();
     foreach ((array) $arr_articles as $key => $art) {
         $article_ids[] = $art['article_id'];
         $tmp_arr_articles[$art['article_id']] = $art;
     }
     if ($article_ids) {
         $sql = "SELECT a.* , b.storage, b.s_url FROM `sdb_content_article_bodys` a LEFT JOIN `sdb_image_image` b ON a.image_id = b.image_id WHERE a.article_id IN (" . join(',', $article_ids) . ") order by a.article_id desc";
         $arr_article_bodys = kernel::database()->select($sql);
     }
     //print_r($arr_article_bodys);
     $arr_articles = $arr_image_ids = array();
     foreach ((array) $arr_article_bodys as $key => $art) {
         $art['s_url'] = '/' . $art['s_url'];
         $arr_articles[] = array_merge($tmp_arr_articles[$art['article_id']], $art);
         $arr_image_ids[] = $art['image_id'];
     }
     //标识用于生成url
     $token = md5("page{$page}");
     $this->pagedata['pager'] = array('current' => $page, 'total' => ceil($count / $pageLimit), 'link' => $this->gen_url(array('app' => 'content', 'ctl' => 'wap_article', 'act' => 'l', 'arg0' => $art_list_id, 'arg2' => $token)), 'token' => $token);
     $filter = array();
     $filter['ifpub'] = 'true';
     $filter['pubtime|than'] = time();
     $arr = $indexsObj->getList('pubtime', $filter, 0, 1, ' pubtime ASC');
     if ($arr) {
         //设置缓存过期时间
         reset($arr);
         $arr = current($arr);
         cachemgr::set_expiration($arr['pubtime']);
     }
     $this->pagedata['cat'] = $aNode[0];
     $this->pagedata['hasimage'] = $info['hasimage'];
     $this->pagedata['articles'] = $arr_articles;
     $this->set_tmpl('articlelist');
     $this->set_tmpl_file($info['list_tmpl_path']);
     if ($info['hasimage'] == 'true') {
         $view = 'wap/article/list_image.html';
     } else {
         $view = 'wap/article/list.html';
     }
     if (is_null($this->weixin_share_page)) {
         $this->weixin_share_page = array();
     }
     if (in_array('article-list', $this->weixin_share_page)) {
         $this->pagedata['from_weixin'] = $this->from_weixin;
         $this->pagedata['weixin']['appid'] = $this->weixin_a_appid;
         $this->pagedata['weixin']['imgUrl'] = base_storager::image_path(app::get('weixin')->getConf('weixin_basic_setting.weixin_logo'));
         $this->pagedata['weixin']['linelink'] = app::get('wap')->router()->gen_url(array('app' => 'content', 'ctl' => 'wap_article', 'act' => 'l', 'arg0' => $art_list_id, 'full' => 1));
         $this->pagedata['weixin']['shareTitle'] = $this->pagedata['title'];
         $this->pagedata['weixin']['descContent'] = $this->pagedata['description'];
     }
     $this->page($view);
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:84,代码来源:article.php

示例8: _set_cache_time

 public function _set_cache_time($cache_time)
 {
     cachemgr::set_expiration($cache_time);
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:4,代码来源:timedbuy.php


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