var_export     文件缓存经常使用    输出或返回一个变量的字符串表示

  1. /**
  2. * 写入缓存
  3. *
  4. * @param string $id
  5. * @param mixed $data
  6. * @param array $policy
  7. */
  8. public function set($mode, $id, $data, $expired = -1)
  9. {
  10. if( empty($mode) || empty($id) ){return false;}
  11. $path = $this->getComFilename($mode ,$id);
  12. $expired = ($expired < 0) ? -1 : time() + $expired;
  13. $content = array(
  14. 'expired' => $expired,
  15. 'data'    => $data,
  16. );
  17. $content = '<?php return ' . var_export($content, true) . ';';
  18. // 写入缓存,并去掉多余空格
  19. file_put_contents($path, $content, LOCK_EX);
  20. // file_put_contents($path, php_strip_whitespace($path), LOCK_EX);
  21. clearstatcache();
  22. $this->_cachelist($path,$mode);//写缓存列表文件
  23. return true;
  24. }

最新文章

  1. Graph cuts图论分割
  2. Spring mvc框架 controller间跳转 ,重定向 ,传参
  3. Bootstrap_按钮工具栏
  4. UDP网络通信OSC 协议
  5. 重构第17天提取父类(Extract SuperClass)
  6. 删除ecshop登录后台看到的系统信息
  7. Delphi里的RTTI与反射(举例换掉FOnChange)
  8. android系统的图片资源
  9. CoreAnimation 寄宿图
  10. 神奇的marquee--滚动的文字
  11. Python 批量翻译 使用有道api;
  12. Nginx和php是怎么通信的?
  13. Cocos2D中Action的进阶使用技巧(一)
  14. Python Excel 多sheet 多条数据 自定义写入
  15. Repository模式与UnitOfWorks模式的运用
  16. 新网站如何做SEO优化【转】
  17. Cocos2D-x-3.0 编译(Win7)
  18. 你都用python来做什么?
  19. RTX——第7章 任务管理
  20. c#通过webrequest请求远程http服务时出现的问题

热门文章

  1. HDU - 3974 Assign the task (线段树区间修改+构建模型)
  2. python-常用数据类型
  3. 微信小程序,错误{&quot;errMsg&quot;:&quot;request:fail 小程序要求的 TLS 版本必须大于等于 1.2&quot;}
  4. mac怎么快速回到桌面 隐藏所有窗口
  5. Python中json一点小知识
  6. 微信小程序开发(2) 计算器
  7. idea 2018.1破解激活方法,有效期至2099年
  8. loj 10181 绿色通道 二分答案+单调队列DP
  9. dubbo 初探
  10. steps/train_sat.sh