本文整理汇总了PHP中dcache函数的典型用法代码示例。如果您正苦于以下问题:PHP dcache函数的具体用法?PHP dcache怎么用?PHP dcache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dcache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editMember
/**
* 编辑会员
* @param array $condition
* @param array $data
*/
public function editMember($condition, $data) {
$update = $this->table('member')->where($condition)->update($data);
if ($update && $condition['member_id']) {
dcache($condition['member_id'], 'member');
}
return $update;
}
示例2: addEvaluateGoodsArray
/**
* 批量添加商品评价
*
* @param array $param
* @param array $goodsid_array 商品id数组,更新缓存使用
* @return boolean
*/
public function addEvaluateGoodsArray($param, $goodsid_array)
{
$result = $this->insertAll($param);
// 删除商品评价缓存
if ($result && !empty($goodsid_array)) {
foreach ($goodsid_array as $goods_id) {
dcache($goods_id, 'goods_evaluation');
}
}
return $result;
}
示例3: _dGoodsComboCache
/**
* 删除商品推荐搭配缓存
* @param int $goods_id
* @return boolean
*/
private function _dGoodsComboCache($goods_id)
{
return dcache($goods_id, 'goods_combo');
}
示例4: 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)));
}
示例5: _dStoreGoodsClassCache
/**
* 删除店铺商品分类缓存
* @param int $store_id
* @return boolean
*/
private function _dStoreGoodsClassCache($store_id)
{
return dcache($store_id, 'store_goods_class');
}
示例6: _dGoodsBundlingCache
/**
* 删除商品优惠套装缓存
* @param int $goods_id
* @return boolean
*/
private function _dGoodsBundlingCache($goods_id)
{
return dcache($goods_id, 'goods_bundling');
}
示例7: _dStorePlateCache
/**
* 删除店铺关联板式缓存缓存
* @param int $plate_id
* @return boolean
*/
private function _dStorePlateCache($plate_id)
{
return dcache($plate_id, 'store_plate');
}
示例8: _dGoodsGroupbuyCache
/**
* 删除商品抢购缓存
* @param int $goods_commonid
* @return boolean
*/
private function _dGoodsGroupbuyCache($goods_commonid)
{
return dcache($goods_commonid, 'goods_groupbuy');
}
示例9: _dGoodsMansongCache
/**
* 删除商品满即送缓存
* @param int $store_id
* @return boolean
*/
private function _dGoodsMansongCache($store_id)
{
return dcache($store_id, 'goods_mansong');
}
示例10: delStore
public function delStore($condition)
{
$store_info = $this->getStoreInfo($condition);
//删除店铺相关图片
@unlink(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $store_info['store_label']);
@unlink(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $store_info['store_banner']);
if ($store_info['store_slide'] != '') {
foreach (explode(',', $store_info['store_slide']) as $val) {
@unlink(BASE_UPLOAD_PATH . DS . ATTACH_SLIDE . DS . $val);
}
}
//清空缓存
dcache($store_info['store_id'], 'store_info');
return $this->where($condition)->delete();
}
示例11: delCircleMember
/**
* 删除管理员
* @param unknown $condition
*/
public function delCircleMember($condition)
{
$result = $this->where($condition)->delete();
if ($result) {
dcache($condition['circle_id'], 'circle_managelist');
}
return $result;
}
示例12: _dGoodsXianshiCache
/**
* 删除商品限时折扣缓存
* @param int $goods_id
* @return boolean
*/
private function _dGoodsXianshiCache($goods_id)
{
return dcache($goods_id, 'goods_xianshi');
}
示例13: _dGoodsGiftCache
/**
* 删除商品公共缓存
* @param int $goods_id
* @return boolean
*/
private function _dGoodsGiftCache($goods_id)
{
return dcache($goods_id, 'goods_gift');
}
示例14: _delMbSpecialCache
/**
* 清理缓存
*/
private function _delMbSpecialCache($special_id)
{
//清理缓存
dcache($special_id, 'mb_special');
//删除静态文件
$html_path = $this->getMbSpecialHtmlPath($special_id);
if (is_file($html_path)) {
@unlink($html_path);
}
}
示例15: _wGoodsImageCache
private function _wGoodsImageCache($key, $image_list)
{
return wcache($key, $image_list, 'goods_image');
}
/**
* 删除商品图片缓存
* @param int $key ($goods_commonid .'|'. $color_id)
* @return boolean
*/