What Happens When I Cache Application.cfc Within The APPLICATION Scope?
Posted March 14, 2007 at 11:39 AM by Ben Nadel
Pretty much nothing exciting :) But I wanted to try it to see if stuff would blow up. If nothing else, it proves that a new Application.cfc instance is created for every single page request. This test is super, ultra simple. Here is my Application.cfc ColdFusion component:
- <cfset THIS.Name = "App Cache Test" />
- <cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 5, 0 ) />
- Here, I am creating a unique ID for this Application.cfc
- just to help see if one instance is the same as another.
- <cfset THIS.ID = CreateUUID() />
- Param an array in the APPLICATION scope to hold all
- of our App.cfc instances.
- default="#ArrayNew( 1 )#"
- Append THIS application.cfc instance to our
- cached array.
- <cfset ArrayAppend(
- ) />
- <cfreturn true />
Then, my index.cfm page merely CFDumps out the APPLICATION scope:
- Dump out the APPLICATION scope. Put in a TOP 10 to
- make sure nothing goes crazy.
After running that page a few times, here is what I get:
| || || |
| || |
| || || |
As you can see, nothing exciting going on here. At least it didn't go kabooom!
- Wanted: Full-Time ColdFusion Developer at Intoria Internet Architects
- Cold Fusion Senior Developer at Edge Information Management
- Back-End Web Developer-Information Technologist at Michigan State University
- ColdFusion Developer at Nonfat Media
- Mid-to-Senior Level Web Application Developer at SiteVision, Inc.