Whatever message this page gives is out now! Go check it out!
| The cfcache tag caching mechanism considers that each URL is a separate page. Therefore, http://www.mySite.com/view.cfm?id=1 and http://www.mySite.com/view.cfm?id=2 result in two separate cached pages. Because ColdFusion caches a separate page for each unique set of URL parameters, the caching mechanism accommodates pages for which different parameters result in different output. |
<cfcache timespan="#CreateTimespan(1, 0, 0, 0)#" directory="e:/temp/page_cache"><cfcache action="flush" directory="e:/temp/page_cache/monthly" expirURL="HR*"><cf output>
W elcome to our home page.<br>
The time is #TimeFormat(Now())#.<br>
Your lucky number is: #RandRa nge(1,1000)#<br>
<hr>
</cfoutput>
<!--- If the flag is false, query the DB, and save an image of
the results output to a variable. ---> <cfcache action="optimal" timespan="#createtimespan(0,1,0,0)#" idletime="#createtimespan(0,0,30,0)#"><!--- Perform database query. ---><cfquery dataSource="cfartgallery" name="specialQuery"> SELECT * from art
</cfquery>
<!--- Calculate sale price and display the results. --->
<h2>Check out the following specials</h2>
<table>
<cfoutput query="specialQuery">
<tr>
<td>#artid#</td>
<td>#Description#</td>
<td>#price#</td>
</tr>
</cfoutput>
</table></cfcache><hr><p>Thank you for visiting us!</p>this.cache.configfile = "c:/cachesettings/ehcache.xml";this.cache.configfile = "ehcache.xml";<cfscript>
this.name = "appSpecificCacheTest";
this.cache.configfile = "ehcache.xml";
this.applicationTimeout = createtimespan(0,0,0,5);
function onApplicationStart(){
writelog("In onApplicationStart()");
}
function onApplicationEnd(){
writelog("In onApplicationEnd()");
}
</cfscript>
</cfcomponent><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>cfhttp</title>
</head>
<!--- End of header --->
<body>
<!--- remove object from Application Specific cache --->
<cfif ArrayLen(cacheGetAllIds()) gt 0>
<cfset cacheRemove(ArrayToList(cacheGetAllIds()))>
</cfif>
<cfset obj1 = structNew()>
<cfset obj1.name = "xyz">
<cfoutput>Starting to write to cache..</cfoutput>
<cfset cachePut("obj1",obj1)>
<br/>
<cfoutput>Done!!</cfoutput>
<cfoutput>Trying to fetch cached item...</cfoutput>
<cfset obj = cacheGet("obj1")>
<br/>
<cfdump var="#obj#">
<cfscript>
sleep(15000);
</cfscript>
<cfoutput>Trying to fetch cached item after 15 seconds...<br/></cfoutput>
<cfset obj = cacheGet("obj1")>
<cfdump var="#obj#">
</body>
</html><ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<diskStore path="java.io.tmpdir"/>
<cacheManagerEventListenerFactory class="" properties=""/>
<defaultCache
maxElementsInMemory="5"
eternal="false"
timeToIdleSeconds="30"
timeToLiveSeconds="5"
overflowToDisk="true"
diskSpoolBufferSizeMB="30"
maxElementsOnDisk="10"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="3600"
memoryStoreEvictionPolicy="LRU"
clearOnFlush="true"
/>
<cache name="app1cache"
maxElementsInMemory="5"
eternal="false"
timeToIdleSeconds="60"
timeToLiveSeconds="5"
overflowToDisk="false"
diskSpoolBufferSizeMB="30"
maxElementsOnDisk="10"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="3600"
memoryStoreEvictionPolicy="LRU"
clearOnFlush="true"/>
</ehcache>this.name ="Object Operations";
this.s3.accessKeyId = "key_ID";
this.s3.awsSecretKey = "secret_key";
this.s3.defaultLocation="location";
</cfscript><cffile action="write" output="S3 Specifications" file="s3://accessKeyID:awsSecretKey@bucket/x/y/sample.txt"/>this.s3.minsizeformultipart=filesize _in_MBowner_full = {email="xxx@yyy.com", permission="full_control"};
aclObj = [owner_full, all_read];<cfset dir = "s3://bucket_name">
<cfif !directoryExists(dir)>
<cfset directorycreate(dir)>
</cfif>
<cfset perm = structnew()>
<cfset perm.group = "all">
<cfset perm.permission = "read">
<cfset perm1 = structnew()>
<cfset perm1.email = "email ID">
<cfset perm1.permission = "FULL_CONTROL">
<cfset myarrray = arrayNew(1)>
<cfset myarrray = [perm,perm1]>
<cfset fileWrite("#dir#/test.txt","This is to test all users permission")>
<cfset StoreSetACL("#dir#/textl.txt","#myarrray#")>
<cfset test = StoreGetACL ("#dirkey#/test.txt") >
<cfdump var= "test">
<cfcatch>
<cfdump var="#cfcatch#">
</cfcatch>
</cftry><cfset dir = "s3://bucket_name/">
<cfset perm = structnew()>
<cfset perm.group = "authenticated">
<cfset perm.permission = "READ">
<cfset perm1 = structnew()>
<cfset perm1.email = "email_ID">
<cfset perm1.permission = "READ_ACP">
<cfset myarrray = [perm,perm1]>
<cfif NOT DirectoryExists(dir)>
<cfset directoryCreate(dir)>
</cfif>
<cfset fileWrite("#dir#/Sample.txt","This is to test StoreAddACL")>
<cfset StoreAddACL("#dir#","#myarrray#")>
<cfset test = StoreGetACL(dirkey)>
<cfdump var="#test#">
<cfcatch>
<cfdump var="#cfcatch#">
</cfcatch>
</cftry><cfset dir = "s3://bucket_Name">
<cfif NOT DirectoryExists(dir)>
<cfset directoryCreate(dir)>
</cfif>
<cfset test = StoreGetACL("#dir#")>
<cfdump var="#test#"><cfdump var = #StoreGetMetadata("bucket_Name")#>mydate = #Now()#;
hello = structNew();
hello.color = "grey";
/cfscript>
<cfset dir = "s3://mycfbucket">
<cffile action="write" file="#dir#/hello5.txt" output="Sample s3 text">
<cfset StoreSetMetadata("#dir#/hello5.txt","#hello#")>
<cfset test = StoreGetMetadata("#dir#/hello5.txt")>
<cfdump var="#test#">file="ram:///filename.cfm"/><cfinclude template="/inmemory/filename.cfm"><cffile action="append" file="ram:///a/b/dynamic.cfm" output="I'm appending">
<cffile action="readBinary" variable="myImage" file="#ExpandPath('./')#/blue.jpg">
<cffile action="write" output="#myImage#" file="ram:///a.jpg">
<cfif FileExists("ram:///a.jpg")>
<cfoutput>a.jpg exists</cfoutput>
<cfelse>
<cfoutput>a.jpg Doesn't exists</cfoutput>
</cfif>file="ram:///filename.cfc"/><cfset cfc=CreateObject("component","inmemory.filename")/><cffile action="read" file="#ExpandPath('./')#/dynamic.cfc" variable="Message">
<cffile action="write" file="ram:///cfc/dynamic.cfc" output="#Message#"><cfinvokeargument name="paramOne" value="hello">
</cfinvoke>
<cfoutput>#returnVariable#</cfoutput></cfcomponent><cffile action="write" file="ram:///a.txt" output="Testing the function FileSetLastModified">
<cfset date="12/12/2007">
<cfscript>
FileSetLastModified("ram:///a.txt", "#date#");
sleep(1000);
WriteOutput(#GetFileInfo("ram:///a.txt").lastmodified#);
</cfscript>
<cfcatch>
<cfset PrintException(cfcatch)>
</cfcatch>
</cftry>
<cf_expectedresults>{ts '2007-12-12 00:00:00'}
</cf_expectedresults><cfdirectory action = "create" directory = "ram://src" >
<cfdirectory action = "create" directory = "ram://des" >
<cfdirectory action = "rename" directory = "ram:///CurrentDir" newDirectory = "NewDir">
<cfdirectory action="list" directory="ram://" name="listDir" recurse="yes" >
<cfdump var="#listDir#">
<cffile action="write" file = "ram://src/test.txt" output = "Release Description">
<cffile action="copy" source="ram://src/test.txt" destination="ram://des/final.txt" >
<cffile action="rename" source = "ram:///src/message.txt" destination = "ram:///des/test.txt">
<cffile action ="move" source = "ram:///des/test.txt" destination = "c:\des\move.txt"><cfimage action="captcha" fontSize="15" width="180" height="50" text="readMe" destination="ram:///readMe.jpg"
difficulty="medium">
<cfimage source="ram://aiden02.png" action="convert" destination="#ExpandPath("./")#/blue1.JPG" overwrite="yes">
<cfdocument format="pdf" filename="ram://Sample.pdf" overwrite="yes">Sample Text</cfdocument><cfcontent file="ram:///a.jpg" type="image/jpeg" deletefile="yes"><cfreport format="PDF" template="ram:///myReport1.cfr" filename="ram:///test.pdf" overwrite="yes"><cfimport prefix="custom" taglib="ram:///a/b/mytags.jar"><cffile action="rename" source="ram:///src1/message2.txt" destination="#ExpandPath('./')#/123.txt">.<cfexecute name="C:\WINDOWS\System32\netstat.exe" arguments="-e" outputFile="ram:///output.txt" timeout="1">
</cfexecute>
<cfset thisPath=ExpandPath("*.*")>action = "read"
file = "ftp://Administrator:Password@Host_Name/ReadmeLater.htm" variable = "varvar">
<cffile action="write" file="ftp://Administrator:Password@Host_Name/ReadmeLater.htm" output="new stuff added">action = "read"
file="zip:#ExpandPath('./')#/hello.zip!/hello.txt"
variable = "varRead1"><cfstoredproc procedure = "foo_proc" dataSource = "MY_SYBASE_TEST"
username = "sa" password = "" returnCode = "Yes">
<!--- cfprocresult tags --->
<cfprocresult name = RS1>
<cfprocresult name = RS3 resultSet = 3>
<!--- cfprocparam tags --->
<cfprocparam type = "IN"
CFSQLType = CF_SQL_INTEGER
value = "1">
<cfprocparam type = "OUT" CFSQLType = CF_SQL_DATE
variable = FOO>
<!--- Close the cfstoredproc tag. --->
</cfstoredproc>
<cfoutput>
The output param value: '#foo#'<br>
</cfoutput>
<h3>The Results Information</h3>
<cfoutput query = RS1>
#name#,#DATE_COL#<br>
</cfoutput>
<br>
<cfoutput>
<hr>
Record Count: #RS1.recordCount#<br>
Columns: #RS1.columnList#<br>
<hr>
</cfoutput>
<cfoutput query = RS3>
#col1#,#col2#,#col3#<br>
</cfoutput>
<br>
<cfoutput>
<hr><br>
Record Count: #RS3.recordCount#<br>
Columns: #RS3.columnList#<br>
<hr>
The return code for the stored procedure is: '#cfstoredproc.statusCode#'<br>
</cfoutput>cachedWithin="#CreateTimeSpan(0,1,0,0)#">
SELECT * FROM Employees
</cfquery>