PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 1ms RepoModel.GetById 40ms app.codeStats 0ms

/wheels/tests/cache/Get.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 28 lines | 23 code | 5 blank | 0 comment | 0 complexity | 58c009544f0d3bc569102f2196e8e397 MD5 | raw file
 1<cfcomponent extends="wheelsMapping.Test">
 2
 3	<cfset pkg.cache = CreateObject("component", "wheels.Cache").init()>
 4
 5	<cffunction name="setup">
 6		<cfset StructDelete(variables, "result")>
 7		<cfset StructDelete(variables, "results")>
 8	</cffunction>
 9
10	<cffunction name="testComplexValue">
11		<cfset var loc = {}>
12		<cfset loc.aQuery = QueryNew("col1,col2")>
13		<cfset pkg.cache.add(key="myQ", value=loc.aQuery)>
14		<cfset result = pkg.cache.get(key="myQ")>
15		<cfset assert("IsQuery(result) AND result.recordCount IS 0")>
16	</cffunction>
17
18	<cffunction name="testExpiration">
19		<cfset var loc = {}>
20		<cfset pkg.cache.add(key="1", value="a")>
21		<cfset result = pkg.cache.get(key="1")>
22		<cfset assert("result IS 'a'")>
23		<cfset loc.currentTime = DateAdd("n", 65, Now())>
24		<cfset result = pkg.cache.get(key="1", currentTime=loc.currentTime)>
25		<cfset assert("IsBoolean(result) AND NOT result")>
26	</cffunction>
27
28</cfcomponent>