在目录【/data/cache/store_grade.php】即:店铺等级缓存。
<?php defined('InShopNC') or exit('Access Invalid!'); return array ( 1 => array ( 'sg_id' => '1', 'sg_name' => '系统默认', 'sg_goods_limit' => '100', 'sg_album_limit' => '500', 'sg_space_limit' => '100', 'sg_template_number' => '6', 'sg_template' => 'default|style1|style2|style3|style4|style5', 'sg_price' => '100.00', 'sg_description' => '用户选择“默认等级”,可以立即开通。', 'sg_function' => '', 'sg_sort' => '0', ), 2 => array ( 'sg_id' => '2', 'sg_name' => '白金店铺', 'sg_goods_limit' => '200', 'sg_album_limit' => '1000', 'sg_space_limit' => '100', 'sg_template_number' => '6', 'sg_template' => 'default|style1|style2|style3|style4|style5', 'sg_price' => '200.00', 'sg_description' => '享受更多特权', 'sg_function' => 'editor_multimedia', 'sg_sort' => '2', ), 3 => array ( 'sg_id' => '3', 'sg_name' => '钻石店铺', 'sg_goods_limit' => '0', 'sg_album_limit' => '1000', 'sg_space_limit' => '100', 'sg_template_number' => '6', 'sg_template' => 'default|style1|style2|style3|style4|style5', 'sg_price' => '1000.00', 'sg_description' => '', 'sg_function' => 'editor_multimedia', 'sg_sort' => '100', ), );
// 店铺等级 $store_grade = H('store_grade'); if (!$store_grade) { $store_grade = H('store_grade', true); }
/** * 读/写 缓存方法 * * H('key') 取得缓存 * H('setting',true) 生成缓存并返回缓存结果 * H('key',null) 清空缓存 * H('setting',true,'file') 生成商城配置信息的文件缓存 * H('setting',true,'memcache') 生成商城配置信息到memcache * @param string $key 缓存名称 * @param string $value 缓存内容 * @param string $type 缓存类型,允许值为 file,memcache,xcache,apc,eaccelerator,可以为空,默认为file缓存 * @param int/null $expire 缓存周期 * @param mixed $args 扩展参数 * @return mixed */ function H($key, $value='', $cache_type='', $expire=null, $args=null){ static $cache = array(); $cache_type = $cache_type ? $cache_type : 'file'; $obj_cache = Cache::getInstance($cache_type,$args); if ($value !== '') { if (is_null($value)) { // 删除缓存 $result = $obj_cache->rm($key); if ($result) unset($cache[$cache_type . '_' . $key]); return $result; }else { // 缓存数据 if ($value === true) $obj_cache->rm($key); $list = Model('cache')->call($key); $obj_cache->set($key, $list, null, $expire); $cache[$cache_type . '_' . $key] = $list; } return $value === true ? $list : true; } if (isset($cache[$cache_type . '_' . $key])) return $cache[$cache_type . '_' . $key]; $value = $obj_cache->get($key); // 取得缓存 $cache[$cache_type . '_' . $key] = $value; return $value; }
其中,店铺等级缓存的来源,【商城管理后台】,数据表【shopnc_store_grade】
原创文章,转载请注明: 转载自HSBLOG
本文链接地址: ShopNC中关于H缓存【店铺等级】