當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wcache函數代碼示例

本文整理匯總了PHP中wcache函數的典型用法代碼示例。如果您正苦於以下問題:PHP wcache函數的具體用法?PHP wcache怎麽用?PHP wcache使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了wcache函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: circleInfoOp

 /**
  * GET 圈子詳情
  */
 public function circleInfoOp()
 {
     $c_id = $_GET['circle_id'];
     if ($c_id != '' && $c_id > 0) {
         $circle_info = Model()->table('circle')->find($c_id);
         if (empty($circle_info)) {
             output_error("圈子不存在");
             die;
         }
         //圈主和管理員信息
         $prefix = 'circle_managelist';
         $manager_list = rcache($this->c_id, $prefix);
         if (empty($manager_list)) {
             $manager_list = Model()->table('circle_member')->where(array('circle_id' => $this->c_id, 'is_identity' => array('in', array(1, 2))))->page($this->page)->select();
             $manager_list = array_under_reset($manager_list, 'is_identity', 2);
             $manager_list[2] = array_under_reset($manager_list[2], 'member_id', 1);
             wcache($this->c_id, $manager_list, $prefix);
         }
         $circle_info['circle_masteravatar'] = getMemberAvatarForID($circle_info['circle_masterid']);
         output_data(array('circle_info' => $circle_info, 'creator' => $manager_list[1][0], 'manager_list' => $manager_list[2]));
     } else {
         output_error("圈子id錯誤");
         die;
     }
 }
開發者ID:ff00x0,項目名稱:shopnc-api,代碼行數:28,代碼來源:circle.php

示例2: getEvaluateGoodsInfoByGoodsID

 /**
  * 根據商品編號查詢商品評價信息 
  */
 public function getEvaluateGoodsInfoByGoodsID($goods_id)
 {
     $prefix = 'evaluation_goods_info';
     $info = rcache($goods_id, $prefix);
     if (empty($info)) {
         $info = array();
         $good = $this->field('count(*) as count')->where(array('geval_goodsid' => $goods_id, 'geval_scores' => array('in', '4,5')))->find();
         $info['good'] = $good['count'];
         $normal = $this->field('count(*) as count')->where(array('geval_goodsid' => $goods_id, 'geval_scores' => array('in', '2,3')))->find();
         $info['normal'] = $normal['count'];
         $bad = $this->field('count(*) as count')->where(array('geval_goodsid' => $goods_id, 'geval_scores' => array('in', '1')))->find();
         $info['bad'] = $bad['count'];
         $info['all'] = $info['good'] + $info['normal'] + $info['bad'];
         if (intval($info['all']) > 0) {
             $info['good_percent'] = intval($info['good'] / $info['all'] * 100);
             $info['normal_percent'] = intval($info['normal'] / $info['all'] * 100);
             $info['bad_percent'] = intval($info['bad'] / $info['all'] * 100);
             $info['good_star'] = ceil($info['good'] / $info['all'] * 5);
         } else {
             $info['good_percent'] = 100;
             $info['normal_percent'] = 0;
             $info['bad_percent'] = 0;
             $info['good_star'] = 5;
         }
         //更新商品表好評星級和評論數
         $model_goods = Model('goods');
         $update = array();
         $update['evaluation_good_star'] = $info['good_star'];
         $update['evaluation_count'] = $info['all'];
         $model_goods->editGoods($update, array('goods_id' => $goods_id));
         wcache($goods_id, $info, $prefix);
     }
     return $info;
 }
開發者ID:noikiy,項目名稱:haifenbao,代碼行數:37,代碼來源:evaluate_goods.model.php

示例3: getMemberInfoByID

 /**
  * 取得會員詳細信息(優先查詢緩存)
  * 如果未找到,則緩存所有字段
  * @param int $member_id
  * @param string $field 需要取得的緩存鍵值, 例如:'*','member_name,member_sex'
  * @return array
  */
 public function getMemberInfoByID($member_id, $fields = '*') {
     $member_info = rcache($member_id, 'member', $fields);
     if (empty($member_info)) {
         $member_info = $this->getMemberInfo(array('member_id'=>$member_id),'*',true);
         wcache($member_id, $member_info, 'member');
     }
     return $member_info;
 }
開發者ID:noikiy,項目名稱:ejia,代碼行數:15,代碼來源:member.model.php

示例4: getEvaluateStoreInfoByScID

 /**
  * 根據分類編號獲取分類評分數據
  */
 public function getEvaluateStoreInfoByScID($sc_id)
 {
     $prefix = 'sc_evaluate_store_info';
     $info = rcache($sc_id, $prefix);
     if (empty($info)) {
         $model_store = Model('store');
         $store_id_string = $model_store->getStoreIDString(array('sc_id' => $sc_id));
         $info = $this->_getEvaluateStore(array('seval_storeid' => array('in', $store_id_string)));
         wcache($sc_id, $info, $prefix);
     }
     return $info;
 }
開發者ID:noikiy,項目名稱:haifenbao,代碼行數:15,代碼來源:evaluate_store.model.php

示例5: manageList

 /**
  * 圈主和管理信息
  */
 protected function manageList()
 {
     $prefix = 'circle_managelist';
     $manager_list = rcache($this->c_id, $prefix);
     if (empty($manager_list)) {
         $manager_list = Model()->table('circle_member')->where(array('circle_id' => $this->c_id, 'is_identity' => array('in', array(1, 2))))->select();
         $manager_list = array_under_reset($manager_list, 'is_identity', 2);
         $manager_list[2] = array_under_reset($manager_list[2], 'member_id', 1);
         wcache($this->c_id, $manager_list, $prefix);
     }
     Tpl::output('creator', $manager_list[1][0]);
     Tpl::output('manager_list', $manager_list[2]);
 }
開發者ID:uwitec,項目名稱:xbshop,代碼行數:16,代碼來源:control.php

示例6: indexOp

 /**
  * 單個商品信息頁
  */
 public function indexOp()
 {
     $goods_id = intval($_GET['goods_id']);
     // 商品詳細信息
     $model_goods = Model('goods');
     $goods_detail = $model_goods->getGoodsDetail($goods_id);
     $goods_info = $goods_detail['goods_info'];
     if (empty($goods_info)) {
         showMessage(L('goods_index_no_goods'), '', 'html', 'error');
     }
     // by 33hao.com
     $rs = $model_goods->getGoodsList(array('goods_commonid' => $goods_info['goods_commonid']));
     $count = 0;
     foreach ($rs as $v) {
         $count += $v['goods_salenum'];
     }
     $goods_info['goods_salenum'] = $count;
     //  添加 end
     $this->getStoreInfo($goods_info['store_id']);
     Tpl::output('spec_list', $goods_detail['spec_list']);
     Tpl::output('spec_image', $goods_detail['spec_image']);
     Tpl::output('goods_image', $goods_detail['goods_image']);
     Tpl::output('mansong_info', $goods_detail['mansong_info']);
     Tpl::output('gift_array', $goods_detail['gift_array']);
     // 生成緩存的鍵值
     $hash_key = $goods_info['goods_id'];
     $_cache = rcache($hash_key, 'product');
     if (empty($_cache)) {
         // 查詢SNS中該商品的信息
         $snsgoodsinfo = Model('sns_goods')->getSNSGoodsInfo(array('snsgoods_goodsid' => $goods_info['goods_id']), 'snsgoods_likenum,snsgoods_sharenum');
         $data = array();
         $data['likenum'] = $snsgoodsinfo['snsgoods_likenum'];
         $data['sharenum'] = $snsgoodsinfo['snsgoods_sharenum'];
         // 緩存商品信息
         wcache($hash_key, $data, 'product');
     }
     $goods_info = array_merge($goods_info, $_cache);
     $inform_switch = true;
     // 檢測商品是否下架,檢查是否為店主本人
     if ($goods_info['goods_state'] != 1 || $goods_info['goods_verify'] != 1 || $goods_info['store_id'] == $_SESSION['store_id']) {
         $inform_switch = false;
     }
     Tpl::output('inform_switch', $inform_switch);
     // 如果使用運費模板
     if ($goods_info['transport_id'] > 0) {
         // 取得三種運送方式默認運費
         $model_transport = Model('transport');
         $transport = $model_transport->getExtendList(array('transport_id' => $goods_info['transport_id'], 'is_default' => 1));
         if (!empty($transport) && is_array($transport)) {
             foreach ($transport as $v) {
                 $goods_info[$v['type'] . "_price"] = $v['sprice'];
             }
         }
     }
     Tpl::output('goods', $goods_info);
     //v3-b11 搶購商品是否開始
     $IsHaveBuy = 0;
     if (!empty($_SESSION['member_id'])) {
         $buyer_id = $_SESSION['member_id'];
         $promotion_type = $goods_info["promotion_type"];
         if ($promotion_type == 'groupbuy') {
             //檢測是否限購數量
             $upper_limit = $goods_info["upper_limit"];
             if ($upper_limit > 0) {
                 //查詢些會員的訂單中,是否已買過了
                 $model_order = Model('order');
                 //取商品列表
                 $order_goods_list = $model_order->getOrderGoodsList(array('goods_id' => $goods_id, 'buyer_id' => $buyer_id, 'goods_type' => 2));
                 if ($order_goods_list) {
                     //取得上次購買的活動編號(防一個商品參加多次團購活動的問題)
                     $promotions_id = $order_goods_list[0]["promotions_id"];
                     //用此編號取數據,檢測是否這次活動的訂單商品。
                     $model_groupbuy = Model('groupbuy');
                     $groupbuy_info = $model_groupbuy->getGroupbuyInfo(array('groupbuy_id' => $promotions_id));
                     if ($groupbuy_info) {
                         $IsHaveBuy = 1;
                     } else {
                         $IsHaveBuy = 0;
                     }
                 }
             }
         }
     }
     Tpl::output('IsHaveBuy', $IsHaveBuy);
     //end
     $model_plate = Model('store_plate');
     // 頂部關聯版式
     if ($goods_info['plateid_top'] > 0) {
         $plate_top = $model_plate->getStorePlateInfoByID($goods_info['plateid_top']);
         Tpl::output('plate_top', $plate_top);
     }
     // 底部關聯版式
     if ($goods_info['plateid_bottom'] > 0) {
         $plate_bottom = $model_plate->getStorePlateInfoByID($goods_info['plateid_bottom']);
         Tpl::output('plate_bottom', $plate_bottom);
     }
     Tpl::output('store_id', $goods_info['store_id']);
//.........這裏部分代碼省略.........
開發者ID:lehman3087,項目名稱:wanhaoshop,代碼行數:101,代碼來源:goods.php

示例7: getHotCollectList

 /**
  * 獲取商品收藏排行
  *
  * @param int $store_id 店鋪編號
  * @param int $limit 數量
  * @return array	商品信息
  */
 public function getHotCollectList($store_id, $limit = 5)
 {
     $prefix = 'store_collect_sales_list_' . $limit;
     $hot_collect_list = rcache($store_id, $prefix);
     if (empty($hot_collect_list)) {
         $model_goods = Model('goods');
         $hot_collect_list = $model_goods->getGoodsOnlineList(array('store_id' => $store_id), '*', 0, 'goods_collect desc', $limit);
         wcache($store_id, $hot_collect_list, $prefix);
     }
     return $hot_collect_list;
 }
開發者ID:bubargaininc,項目名稱:oak_oak,代碼行數:18,代碼來源:store.model.php

示例8: _wGoodsBundlingCache

 /**
  * 寫入商品優惠套裝緩存
  * @param int $goods_id
  * @param array $array
  * @return boolean
  */
 private function _wGoodsBundlingCache($goods_id, $array)
 {
     return wcache($goods_id, $array, 'goods_bundling');
 }
開發者ID:dotku,項目名稱:shopnc_cnnewyork,代碼行數:10,代碼來源:p_bundling.model.php

示例9: getEvaluateStoreInfoByScID

 /**
  * 根據分類編號獲取分類評分數據
  */
 public function getEvaluateStoreInfoByScID($sc_id)
 {
     $prefix = 'sc_evaluate_store_info';
     $info = rcache($sc_id, $prefix);
     if (empty($info)) {
         $model_store = Model('store');
         $store_id_string = $model_store->getStoreIDString(array('sc_id' => $sc_id));
         $info = $this->_getEvaluateStore(array('seval_storeid' => array('in', $store_id_string)));
         $cache = array();
         $cache['evaluate_store_info'] = serialize($info);
         wcache($sc_id, $cache, $prefix, 60 * 24);
     } else {
         $info = unserialize($info['evaluate_store_info']);
     }
     return $info;
 }
開發者ID:ff00x0,項目名稱:shopnc,代碼行數:19,代碼來源:evaluate_store.model.php

示例10: editbrand

 public function editbrand($update, $condition)
 {
     //清空緩存
     $store_list = $this->getStoreList($condition);
     foreach ($store_list as $value) {
         wcache($value['brand_id'], array(), 'store_info');
     }
     return $this->where($condition)->update($update);
 }
開發者ID:bubargaininc,項目名稱:oak_oak,代碼行數:9,代碼來源:brand.model.php

示例11: get_member_detail_info

 /**
  * 用戶詳細信息
  */
 protected function get_member_detail_info($member_info)
 {
     //生成緩存的鍵值
     $member_id = $member_info['member_id'];
     if ($member_id <= 0) {
         return null;
     }
     //寫入緩存的數據
     $cachekey_arr = array('member_name', 'store_id', 'member_avatar', 'member_qq', 'member_email', 'member_msn', 'member_ww', 'member_points', 'available_predeposit', 'member_snsvisitnum', 'credit_arr', 'fan_count', 'attention_count');
     //先查找$member_id緩存
     if ($_cache = rcache($member_id, 'sns_member')) {
         foreach ($_cache as $k => $v) {
             $member_info[$k] = $v;
         }
     } else {
         $model = Model();
         //粉絲數
         $fan_count = $model->table('sns_friend')->where(array('friend_tomid' => $member_id))->count();
         $member_info['fan_count'] = $fan_count;
         //關注數
         $attention_count = $model->table('sns_friend')->where(array('friend_frommid' => $member_id))->count();
         $member_info['attention_count'] = $attention_count;
         //興趣標簽
         $mtag_list = $model->table('sns_membertag,sns_mtagmember')->field('mtag_name')->on('sns_membertag.mtag_id = sns_mtagmember.mtag_id')->join('inner')->where(array('sns_mtagmember.member_id' => $member_id))->select();
         $tagname_array = array();
         if (!empty($mtag_list)) {
             foreach ($mtag_list as $val) {
                 $tagname_array[] = $val['mtag_name'];
             }
         }
         $member_info['tagname'] = $tagname_array;
         wcache($member_id, $member_info, 'sns_member');
     }
     return $member_info;
 }
開發者ID:bubargaininc,項目名稱:oak_oak,代碼行數:38,代碼來源:control.php

示例12: browseOp

 /**
  * 將緩存中的瀏覽記錄存入數據庫中,並刪除30天前的瀏覽曆史
  */
 public function browseOp()
 {
     $model = Model('goods_browse');
     //將cache中的記錄存入數據庫
     if (C('cache.type') != 'file') {
         //如果瀏覽記錄已經存入了緩存中,則將其整理到數據庫中
         //上次更新緩存的時間
         $latest_record = $model->getGoodsbrowseOne(array(), '', 'browsetime desc');
         $starttime = ($t = intval($latest_record['browsetime'])) ? $t : 0;
         $monthago = strtotime(date('Y-m-d', time())) - 86400 * 30;
         $model_member = Model('member');
         //查詢會員信息總條數
         $countnum = $model_member->getMemberCount(array());
         $eachnum = 100;
         for ($i = 0; $i < $countnum; $i += $eachnum) {
             //每次查詢100條
             $member_list = $model_member->getMemberList(array(), '*', 0, 'member_id asc', "{$i},{$eachnum}");
             foreach ((array) $member_list as $k => $v) {
                 $insert_arr = array();
                 $goodsid_arr = array();
                 //生成緩存的鍵值
                 $hash_key = $v['member_id'];
                 $browse_goodsid = rcache($hash_key, 'goodsbrowse', 'goodsid');
                 if ($browse_goodsid) {
                     //刪除緩存中多餘的瀏覽曆史記錄,僅保留最近的30條瀏覽曆史,先取出最近30條瀏覽曆史的商品ID
                     $cachegoodsid_arr = $browse_goodsid['goodsid'] ? unserialize($browse_goodsid['goodsid']) : array();
                     unset($browse_goodsid['goodsid']);
                     if ($cachegoodsid_arr) {
                         $cachegoodsid_arr = array_slice($cachegoodsid_arr, -30, 30, true);
                     }
                     //處理存入數據庫的瀏覽曆史緩存信息
                     $_cache = rcache($hash_key, 'goodsbrowse');
                     foreach ((array) $_cache as $c_k => $c_v) {
                         $c_v = unserialize($c_v);
                         if ($c_v['browsetime'] >= $starttime) {
                             //如果 緩存中的數據未更新到數據庫中(即添加時間大於上次更新到數據庫中的數據時間)則將數據更新到數據庫中
                             $tmp_arr = array();
                             $tmp_arr['goods_id'] = $c_v['goods_id'];
                             $tmp_arr['member_id'] = $v['member_id'];
                             $tmp_arr['browsetime'] = $c_v['browsetime'];
                             $tmp_arr['gc_id'] = $c_v['gc_id'];
                             $tmp_arr['gc_id_1'] = $c_v['gc_id_1'];
                             $tmp_arr['gc_id_2'] = $c_v['gc_id_2'];
                             $tmp_arr['gc_id_3'] = $c_v['gc_id_3'];
                             $insert_arr[] = $tmp_arr;
                             $goodsid_arr[] = $c_v['goods_id'];
                         }
                         //除了最近的30條瀏覽曆史之外多餘的瀏覽曆史記錄或者30天之前的瀏覽曆史從緩存中刪除
                         if (!in_array($c_v['goods_id'], $cachegoodsid_arr) || $c_v['browsetime'] < $monthago) {
                             unset($_cache[$c_k]);
                         }
                     }
                     //刪除已經存在的該商品瀏覽記錄
                     if ($goodsid_arr) {
                         $model->delGoodsbrowse(array('member_id' => $v['member_id'], 'goods_id' => array('in', $goodsid_arr)));
                     }
                     //將緩存中的瀏覽曆史存入數據庫
                     if ($insert_arr) {
                         $model->addGoodsbrowseAll($insert_arr);
                     }
                     //重新賦值瀏覽曆史緩存
                     dcache($hash_key, 'goodsbrowse');
                     $_cache['goodsid'] = serialize($cachegoodsid_arr);
                     wcache($hash_key, $_cache, 'goodsbrowse');
                 }
             }
         }
     }
     //刪除30天前的瀏覽曆史
     $model->delGoodsbrowse(array('browsetime' => array('lt', $monthago)));
 }
開發者ID:xuxuecheng,項目名稱:shopnc,代碼行數:74,代碼來源:goods.php

示例13: _wGoodsMansongCache

 /**
  * 寫入商品滿即送緩存
  * @param int $store_id
  * @param array $mansong_info
  * @return boolean
  */
 private function _wGoodsMansongCache($store_id, $mansong_info)
 {
     return wcache($store_id, $mansong_info, 'goods_mansong');
 }
開發者ID:flying3615,項目名稱:chuniang,代碼行數:10,代碼來源:p_mansong.model.php

示例14: delPointCart

	/**
	 * 刪除特定條件禮品購物車信息
	 * @param	mixed $pc_id 刪除記錄編號
	 */
	public function delPointCart($where, $member_id = 0){
		$result = $this->table('points_cart')->where($where)->delete();
		//清除相關緩存
		if ($result && $member_id > 0){
		    wcache($member_id, array('pointcart_count' => null), 'm_pointcart');
		}
		return $result;
	}
開發者ID:noikiy,項目名稱:ejia,代碼行數:12,代碼來源:pointcart.model.php

示例15: getGoodsCountByStoreArray

 /**
  * 獲取店鋪商品數
  *
  * @param array $store_array 店鋪數組
  * @return array $store_array 包含商品數goods_count的店鋪數組
  */
 public function getGoodsCountByStoreArray($store_array)
 {
     $store_array_new = array();
     $model = Model();
     $no_cache_store = '';
     foreach ($store_array as $value) {
         $goods_count = rcache($value['store_id'], 'store_goods_count');
         if (!empty($goods_count) && $goods_count !== FALSE) {
             //有緩存的直接賦值
             $value['goods_count'] = $goods_count;
         } else {
             //沒有緩存記錄store_id,統計從數據庫讀取
             $no_cache_store .= $value['store_id'] . ',';
             $value['goods_count'] = '0';
         }
         $store_array_new[$value['store_id']] = $value;
     }
     if (!empty($no_cache_store)) {
         //從數據庫讀取店鋪商品數賦值並緩存
         $no_cache_store = rtrim($no_cache_store, ',');
         $condition = array();
         $condition['goods_state'] = '1';
         $condition['store_id'] = array('in', $no_cache_store);
         $goods_count_array = $model->table('goods')->field('store_id,count(*) as goods_count')->where($condition)->group('store_id')->select();
         if (!empty($goods_count_array)) {
             foreach ($goods_count_array as $value) {
                 $store_array_new[$value['store_id']]['goods_count'] = $value['goods_count'];
                 wcache($value['store_id'], $value['goods_count'], 'store_goods_count');
             }
         }
     }
     return $store_array_new;
 }
開發者ID:dotku,項目名稱:shopnc_cnnewyork,代碼行數:39,代碼來源:store.model.php


注:本文中的wcache函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。