<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日韩av综合| 亚洲精品国产福利在线观看| 国产亚洲精品欧洲在线观看| 国产一级淫片视频免费看 | 亚洲成AV人片在线观看无码| www.av在线免费观看| 久久久久亚洲精品无码网址 | 亚洲精品在线观看视频| 日韩精品无码免费专区午夜不卡| 亚洲免费观看视频| 久久狠狠躁免费观看| 亚洲高清无在码在线无弹窗| 日本最新免费网站| 国产成人亚洲精品| 国产jizzjizz视频免费看| 免费无码午夜福利片69| 亚洲综合AV在线在线播放| 久久精品视频免费看| 亚洲噜噜噜噜噜影院在线播放| 好男人视频在线观看免费看片| 亚洲欧美不卡高清在线| 亚洲精品高清在线| 未满十八18禁止免费无码网站 | 亚洲人成无码网站久久99热国产| 国产一级一毛免费黄片| 亚洲视频在线观看| 在线观看视频免费国语| 一级毛片在线免费播放| 久久久久久亚洲AV无码专区| 最近中文字幕无吗免费高清| 又大又硬又粗又黄的视频免费看 | 久久久久亚洲精品天堂久久久久久 | 国产偷国产偷亚洲高清日韩| 国产精品免费福利久久| 亚洲天堂2016| 国产精品亚洲αv天堂无码| 亚洲免费一级视频| 一级做a爰全过程免费视频毛片| 亚洲综合在线观看视频| 国产男女性潮高清免费网站| 久久久久久国产精品免费免费男同|