Where to store static contents for home/index page
I'm developing a vehicle portal using Play framework and most of the search-display-paginate functionality has been implemented. I'm a bit confused when it comes to designing the home page with caching in mind.
The home page will be a mix of pure static and dynamic contents. But the dynamic contents (such as reports, market trends and other user posted blogs, adv pictures, etc) itself might not get updated/added 开发者_JAVA百科every day. I can think of two options:
- To have static home.html page with all contents and modify the page when the content get updated.
- To have home.html get dynamically rendered from the content stored in Database.
My questions are:
- Which one is more graceful? and usually more of a standard practice ? Is there any other way can anyone suggest ?
- Is there a way to integrate CMS systems to manage these contents along with Play-framework? or Should I develop one basic CMS with Play! and integrate.
- Does using CMS just to manage home page seems to be a standard way ?
My preference here would to build a dynamic home page, that uses the Cache function within Play to improve performance.
Although you can (and there are examples of this already done with Play) where a CMS has been integrated, I think it sounds overkill for your needs. Where as the dynamic part of your page does not sound too large, so maintaining it in a simple database should be pretty simple.
To Cache your homepage, you can use the @CacheFor
annotation against the controller action.
@CacheFor("1h") public static void home() {
// ... your home page controller code here
}
This will mean any DB code etc that occurs will only execute once per hour, and the output will be cached.
精彩评论