Session scopes query caching - cache query data in session scope
QueryCacheSessionScope.cfm
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Session scopes query caching - how to cache query data in session scope</title>
</head>
<body>
<h2 style="color:Crimson; font-style:italic">ColdFusion query caching example: how to cache query in session scope</h2>
<hr width="600" align="left" color="LightPink" />
<br />
<!--at first enable session management in application.cfm file-->
<cfset Session.UserName="cfsuman">
<cfquery name="Session.Authors" datasource="cfbookclub" maxrows="2">
select AuthorID, FirstName, LastName from Authors
</cfquery>
<cfdump var="#Session#" label="Session">
<br />
<table border="0" cellpadding="2" cellspacing="2" bgcolor="OrangeRed">
<tr style="background-color:DeepPink; color:Snow; font-weight:bold;">
<td>
Author ID
</td>
<td>
First Name
</td>
<td>
Last Name
</td>
</tr>
<cfoutput query="Session.Authors">
<tr style="color:Snow; background-color:HotPink; font-family:'Courier New', Courier, monospace;">
<td>
#AuthorID#
</td>
<td>
#FirstName#
</td>
<td>
#LastName#
</td>
</tr>
</cfoutput>
</table>
</body>
</html>
- CFMAP - Generate an earth type google map in ColdFusion
- CFAJAXIMPORT to specify Google map API Key in ColdFusion
- ColdFusion CFscript - Invoke a component in script
- cfqueryparam- how to use cfqueryparam in cfquery tag
- How to use cfsqltype in cfqueryparam tag in ColdFusion
- How to use NOT EQUAL operator in cfif condition in ColdFusion
- How to use NEQ operator in cfif condition in ColdFusion
- ColdFusion variables typeless feature
- ColdFusion number and date format mask
- ColdFusion dynamic variables