<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Tao

    Tao obeys its own inherent Nature

    How To: Clear cache for symfony

    Original article: http://www.symfony-project.com/book/1_0/18-Performance

    Clearing Selective Parts of the Cache

    During application development, you have to clear the cache in various situations:

    • When you create a new class: Adding a class to an autoloading directory (one of the project's lib/ folders) is not enough to have symfony find it automatically. You must clear the autoloading configuration cache so that symfony browses again all the directories of the autoload.yml file and references the location of autoloadable classes--including the new ones.
    • When you change the configuration in production: The configuration is parsed only during the first request in production. Further requests use the cached version instead. So a change in the configuration in the production environment (or any environment where SF_DEBUG is turned off) doesn't take effect until you clear the cached version of the file.
    • When you modify a template in an environment where the template cache is enabled: The valid cached templates are always used instead of existing templates in production, so a template change is ignored until the template cache is cleared or outdated.
    • When you update an application with the sync command: This case usually covers the three previous modifications.

    The problem with clearing the whole cache is that the next request will take quite long to process, because the configuration cache needs to be regenerated. Besides, the templates that were not modified will be cleared from the cache as well, losing the benefit of previous requests.

    That means it's a good idea to clear only the cache files that really need to be regenerated. Use the options of the clear-cache task to define a subset of cache files to clear, as demonstrated in Listing 18-14.

    Listing 18-14 - Clearing Only Selective Parts of the Cache

    // Clear only the cache of the myapp application
    > symfony clear-cache myapp

    // Clear only the HTML cache of the myapp application
    > symfony clear-cache myapp template

    // Clear only the configuration cache of the myapp application
    > symfony clear-cache myapp config

    You can also remove files by hand in the cache/ directory, or clear template cache files selectively from the action with the $cacheManager->remove() method, as described inChapter 12

     

    Note:

    1. We can use $cacheManager->remove() to clear cache after we deployed a new version product.

    2. write code to generate models from database, and then call $cacheManager->remove() to clear cache.


     

    posted on 2007-11-13 17:23 wade 閱讀(623) 評論(0)  編輯  收藏 所屬分類: PHPSymfony


    只有注冊用戶登錄后才能發表評論。


    網站導航:
    博客園   IT新聞   Chat2DB   C++博客   博問  
     

    導航

    <2007年11月>
    28293031123
    45678910
    11121314151617
    18192021222324
    2526272829301
    2345678

    統計

    常用鏈接

    留言簿(7)

    隨筆分類

    隨筆檔案

    相冊

    Photo

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲AV本道一区二区三区四区| 一级做a爰片久久毛片免费陪| 久久亚洲精品无码播放| 亚洲国产综合精品中文第一| 日本免费电影一区| 88av免费观看入口在线| 亚洲不卡影院午夜在线观看| 亚洲精品亚洲人成在线观看| 亚洲成A人片在线观看无码3D | 免费中文字幕在线| 一级视频在线免费观看| 亚洲爆乳精品无码一区二区| 久久久青草青青国产亚洲免观| 日韩在线免费看网站| 免费电影在线观看网站| 四虎在线最新永久免费| 日韩精品视频在线观看免费| 91久久亚洲国产成人精品性色| 中文字幕在线亚洲精品| 精品国产香蕉伊思人在线在线亚洲一区二区 | eeuss影院www天堂免费| 久久精品国产亚洲av麻豆小说| 成人毛片18岁女人毛片免费看 | 免费在线视频一区| 日本无吗免费一二区| 日韩a级毛片免费观看| 毛片a级毛片免费播放100| 无限动漫网在线观看免费| 岛国精品一区免费视频在线观看 | 国产成人3p视频免费观看| 永久黄网站色视频免费观看| 日韩电影免费在线观看| 亚洲丁香婷婷综合久久| 亚洲精品国产综合久久久久紧| 亚洲色偷精品一区二区三区| 亚洲成熟丰满熟妇高潮XXXXX| 亚洲AV无码成人精品区狼人影院| 亚洲国产精品日韩av不卡在线| 亚洲AV无码AV吞精久久| 黄色免费网址在线观看| 亚洲精品国产日韩无码AV永久免费网|