zoukankan      html  css  js  c++  java
  • 方维,给商品详情加一个相似价格的商品的功能,用缓存

    方维分享系统,有个 你可能还喜欢 的模块,我想再加个 价格关联 的相关分享,然后去分析 分享系统的缓存机制,他的流程;

    note.module.php 里面分析getRelatedSharesByShareIdAndTags()

      ①

      $key = 'share/related/'.substr($key,0,2).'/'.substr($key,2,2).'/'.$key;
      $result = FS('Delay')->get($key);

      $cids[]商品的分类;$tags商品的tag;这两个组合        在/public/data/cache/custem/share/related/2e/6f/2e6f97eedf9e17a188061ea4c****7d2.cache.php

      ②

      $share_ids有的话,

      setCache($related_key,$list,SHARE_CACHE_TIME);

      生成缓存文件:路径/public/data/cache/custem/share/000/000/097/15/related.cache.php

      ③

      args有值的话,FS('Delay')->create(array('m'=>'share','a'=>'related','args'=>$args));也就是对应的①的FS('Delay')->get($key)

      

     实现sql

    $list = FDB::fetchAll('SELECT s.share_id,s.uid,s.content,s.collect_count,s.comment_count,s.create_time,s.cache_data,abs(g.price-'.$price.') as price_cha FROM '.FDB::table('share').' as s inner join '.FDB::table('share_goods').' as g on s.share_id=g.share_id  WHERE s.share_id IN ('.implode(',',$share_ids).') order by price_cha asc limit 30');
  • 相关阅读:
    Codeforces Round #384 (Div. 2)
    Codeforces Round #383 (Div. 2)
    bzoj-4514(网络流)
    bzoj-4518 4518: [Sdoi2016]征途(斜率优化dp)
    bzoj-1096 1096: [ZJOI2007]仓库建设(斜率优化dp)
    hdu-5988 Coding Contest(费用流)
    hdu-5992 Finding Hotels(kd-tree)
    用链表实现杭电1276士兵队列训练问题
    循环链表
    图书管理系统
  • 原文地址:https://www.cnblogs.com/wangtongphp/p/3114282.html
Copyright © 2011-2022 走看看