From: <ndi...@us...> - 2002-10-30 03:00:32
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv5127/bacfug/modus/persistence Modified Files: basepersister.cfc Log Message: a nicer way to deal with the cache, though it will need to change in the final -- it shows that we can reuse a memory-based component for caching when it will have no instance data. Index: basepersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/basepersister.cfc,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** basepersister.cfc 29 Oct 2002 00:06:07 -0000 1.10 --- basepersister.cfc 30 Oct 2002 03:00:29 -0000 1.11 *************** *** 2,8 **** <cfparam name="instance" default="#structNew()#"> <cffunction name="init" access="public" hint="The initializer" returnType="org.bacfug.modus.persistence.basePersister" output="no"> <cfscript> //the cache we should use ! instance.cache = createObject("component",getCachePath()).init(); </cfscript> <cfreturn this> --- 2,22 ---- <cfparam name="instance" default="#structNew()#"> <cffunction name="init" access="public" hint="The initializer" returnType="org.bacfug.modus.persistence.basePersister" output="no"> + <cfset var cachePathToUse = getCachePath()> <cfscript> //the cache we should use ! //if it has been cached, use the cached version ! ! /******************************* ! THIS REALLY IS A GOOD CANDIDATE FOR THE CONFIG DATA! ! ********************************/ ! ! if(NOT structKeyExists(server.modus,cachePathToUse)){ ! instance.cache = createObject("component",getCachePath()).init(); ! server.modus[cachePathToUse] = instance.cache; ! } ! //otherwise, make a new one ! else{ ! instance.cache = server.modus[cachePathToUse]; ! } </cfscript> <cfreturn this> |