![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipwDKVj0Fl7Bp6KbhV7vOaLY0fGTfJKmKG1xMWGrsnWxDwRfDtH0rYLUtgnxmov5K3E7-wtY3MIV3CXGtryAuwlA3tassMtysTBLbMEi8pskO4NwpucNb2HOnqN9OAhACpr6uWXcdMKBnC/s320/flow_cache_action.png) |
Cache action |
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFVxkWfa7rkIuWx95gGl9B_8ODkmBbnDPfKDwU3na_TI1E7SUz8HvU_UP0ntkm2Y7FM5a6-YgySlCBBaeC2yoiafiZmvRmuBo1jnUzpGs8Rb8ZVW5QdfvVEOdkeBAaVcOgYCJKSy9KKKOf/s320/flow_cache_partial.png) |
Cache partial |
- Trang có phần liên tục động kiểu như User đang online => Ko được thiết lập cache mà with_layout: true
- Trang đọc chi tiết tin bài
+ Cache: article/show
- Trang in chi tiết tin bài không có gì động nên cache toàn trang luôn (with_layout: true)
+ Cache: modules/article/config/cache.yml
showPrint
enabled: true
lifetime: 86400
with_layout: true
- Trong category/index có include component category/_listRecentArticles
index:
enabled: true
lifetime: 86400
Nếu enabled của index là true rồi thì cấu hình dưới đây có giá trị là gì cũng chả có ý nghĩa! Hiểu nôm na nếu cấu hình cache true cho cái bao trùm rồi thì mặc nhiên cái con nằm trong là bị cache?
_listRecentArticles:
enabled: true
lifetime: 86400
You can also work the other way around: enable the cache globally and then, disable it on specific pages that cannot be cached. It depends on which represents the less work for your application.
[*] Có thể bật cache cùng debug để kiểm tra kết quả cache, phần cache được sẽ có màu vàng!
Khi cache có thể gặp vấn đề với culture (mulitple language - hỗ trợ đa ngôn ngữ), tham khảo thêm ở đây http://meh.get-it.us/2010/07/14/language-conditional-caching-in-symfony/