That would be an article I wrote. The tag was called scopeCache and was
pretty simple. This is the MX version. The nonMX version would need
loads of locks. This shold be extended to support things like timeouts,
etc.

<cfif not isDefined("attributes.name") or not
isSimpleValue(attributes.name)>
        <cfthrow message="scopeCache: The name attribute must be passed
as a string.">
</cfif>
<cfif not isDefined("attributes.scope") or not
isSimpleValue(attributes.scope) or not
listFindNoCase("application,session,server",attributes.scope)>
        <cfthrow message="scopeCache: The scope attribute must be passed
as one of: application, session, or server.">
</cfif>

<!--- create pointer to scope --->
<cfset ptr = structGet(attributes.scope)>
<!--- init cache root --->
<cfif not structKeyExists(ptr,"scopeCache")>
        <cfset ptr["scopeCache"] = structNew()>
</cfif>

<cfif isDefined("attributes.clear") and
structKeyExists(ptr.scopeCache,attributes.name)>
        <cfset structDelete(ptr.scopeCache,attributes.name)>
        <cfexit>
</cfif>

<cfif thisTag.executionMode is "start">
        <!--- determine if we have the info in cache already --->
        <cfif structKeyExists(ptr.scopeCache,attributes.name)>
                <cfoutput>#ptr.scopeCache[attributes.name]#</cfoutput>
                <cfexit>
        </cfif>
<cfelse>
        <cfset ptr.scopeCache[attributes.name] =
thistag.generatedcontent>
</cfif>

========================================================================
===
Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
(www.mindseye.com)
Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)

Email    : [EMAIL PROTECTED]
Blog     : www.camdenfamily.com/morpheus/blog
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Rich Z [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, July 27, 2003 6:36 PM
> To: CF-Talk
> Subject: Caching custom tag article somewhere?
> 
> 
> Guys:
>  
> I could have SWORN I'd read an article that explained a 
> custom tag (very simple one actually) that gave the user the 
> option of defining which scope to cache the content, etc. 
> Real neat little tag. I THINK the article was in CFDJ, but I 
> can't find it in the archives. 
>  
> Can someone help?
>  
> Rich
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to