<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 閱讀(622) 評論(0)  編輯  收藏 所屬分類: PHPSymfony


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


    網站導航:
     

    導航

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

    統計

    常用鏈接

    留言簿(7)

    隨筆分類

    隨筆檔案

    相冊

    Photo

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲人成网站在线观看播放动漫| 亚洲国产高清人在线| 亚洲日韩AV无码一区二区三区人| 免费A级毛片无码专区| 久久亚洲AV午夜福利精品一区| 久久精品无码专区免费| 国产亚洲精品精品国产亚洲综合| 午夜免费国产体验区免费的| 亚洲第一页日韩专区| eeuss免费天堂影院| 中文亚洲成a人片在线观看| 国产在线精品观看免费观看| 亚洲人成网77777亚洲色| 青青操免费在线观看| 亚洲专区在线视频| 国产在线国偷精品产拍免费| 亚洲精品天堂在线观看| 日本特黄a级高清免费大片| 狼人大香伊蕉国产WWW亚洲| 亚洲欧洲自拍拍偷精品 美利坚 | 亚洲春色在线视频| 99久久国产免费-99久久国产免费| 1区1区3区4区产品亚洲 | 免费一级毛片不卡在线播放| 午夜亚洲国产精品福利| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 自拍偷自拍亚洲精品被多人伦好爽| 中国性猛交xxxxx免费看| 亚洲成在人天堂在线| 久久久久久久久免费看无码| 国产精品亚洲专区无码不卡| 亚洲另类激情综合偷自拍图| 91精品免费久久久久久久久| 黄色a级免费网站| 亚洲第一区香蕉_国产a| 成人a免费α片在线视频网站| 老司机午夜免费视频| 亚洲精品视频免费在线观看| 婷婷综合缴情亚洲狠狠尤物| 久久九九免费高清视频| 亚洲乱码卡三乱码新区|