A line of code to implement the cache of temporary file saving, four lines of code to achieve cache judgment, three lines of code to implement temporary file invocation
Source Dynamic Web page
<title> Example: Implementing static caching of Dynamic Web pages </title>
(example file: _samples/file_page.html)
Read the cached static file information
<file act=info>web-inf/cache/page_test.html</file>
Determine if a static file exists
<if x= "@{file:exists}" else=0> <call>page</call> <callx=true>cache</call> </if>
exists on the call Cache , the call is not present page
<call>page</call> <call x=true>cache</call>
Callable Tag Cache , read cache file
<chtml onlycallid=cache><file act=read method=str name=page>web-inf/cache/page_test.html</file> </chtml>
Callable Tags Page
<chtml id=page file= "@{sys:curpath}file_page.html" save= "web-inf/cache/page_test.html" Onlycall/>
Introduce dynamic Web page file @{sys:curpath}file_page.htmland Save as web-inf/cache/page_test.html file
displaying cached content
@{file:page}
Full code
Effect
(example file: _samples/file_cache.html)
Experience it!
Download and description of light-open platform resources
Platform and Latest development Manuals free Download: http://download.csdn.net/detail/tx18/8464425
Development example: Light Open e-commerce website , free download: http://download.csdn.net/detail/tx18/8318585
The light-open platform will be upgraded to provide you with more powerful and easy features, please note the latest development manuals
Example: implementing static caching of Dynamic Web pages