zoukankan      html  css  js  c++  java
  • smarty2 缓存

    缓存减少服务器编译和数据交互的压力,加速网站

    缓存未开启
    smarty模板页面改变-》complice页面变化 smarty模板分配的值变化-》complice页面中值随之变化

    缓存开启
    smarty模板页面改变-》complice页面变化 cache页面变化 smarty模板分配的值变化-》读取cache文件,缓存期内值无变化

    配置
    $smarty->cache_dir = "/cache/"; //缓存目录
    $smarty->caching = true; //开启缓存,为flase的时侯缓存无效
    $smarty->cache_lifetime = 60; //缓存时间(单位 秒)

    局部缓存
    insert函数 默认不缓存的信息 是设置函数引用返回信息
    php中 function insert_funname() { return ss;}
    tpl中 {insert name=funname}

    其他
    $smarty->display(‘模板文件’, 缓存id); //创建带ID的缓存
    $smarty->clear_all_cache(); //清除所有缓存
    $smarty->clear_cache(‘模板文件‘); //清除指定模板文件的缓存
    $smarty->clear_cache(‘模板文件’,缓存id); //清除指定id的缓存

  • 相关阅读:
    Angular(一)
    多变的形状
    二叉树
    快速排序
    冒泡排序
    插入排序
    大话程序猿眼里的高并发架构
    整屏滚动
    增加删除一行标签
    无缝滚动
  • 原文地址:https://www.cnblogs.com/caps/p/2941704.html
Copyright © 2011-2022 走看看