From: <ndi...@us...> - 2002-09-12 19:17:12
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv28154/bacfug/modus/persistence Modified Files: basepersister.cfc Log Message: got caching working. Should make performance much better. Index: basepersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/basepersister.cfc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** basepersister.cfc 8 Sep 2002 08:37:32 -0000 1.6 --- basepersister.cfc 12 Sep 2002 19:17:10 -0000 1.7 *************** *** 98,102 **** <!--- populate one object instance from another ---> ! <cffunction name="contentObjectPopulateFromInstance" access="package" returnType="org.bacfug.modus.baseContentObject" output="no" hint="Populates one contentObject instance from another"> <cfargument name="contentObjectPopulatee" type="org.bacfug.modus.baseContentObject" required="yes"> <cfargument name="contentObjectPopulator" type="org.bacfug.modus.baseContentObject" required="yes"> --- 98,102 ---- <!--- populate one object instance from another ---> ! <cffunction name="contentObjectPopulateFromInstance" access="public" returnType="org.bacfug.modus.baseContentObject" output="no" hint="Populates one contentObject instance from another"> <cfargument name="contentObjectPopulatee" type="org.bacfug.modus.baseContentObject" required="yes"> <cfargument name="contentObjectPopulator" type="org.bacfug.modus.baseContentObject" required="yes"> *************** *** 159,170 **** <!--- is the cache primed ---> <cffunction name="isCacheInitialized" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether the cache is initialized"> ! <cfreturn structKeyExists(server,"modusCache")> </cffunction> <!--- initialize the cache ---> <cffunction name="cacheInit" access="package" output="no" returnType="void" hint="Initializes the in-memory cache"> <cfscript> ! server.modusCache = structNew(); ! server.modusCache.objectInstances = structNew(); ! server.modusCache.objectTypes = structNew(); </cfscript> </cffunction> --- 159,171 ---- <!--- is the cache primed ---> <cffunction name="isCacheInitialized" access="package" output="no" returnType="boolean" hint="Returns a boolean for whether the cache is initialized"> ! <cfreturn structKeyExists(server,"modus") AND structKeyExists(server.modus,"contentObjectCache") AND structKeyExists(server.modus.contentObjectCache,"objectInstances")> </cffunction> <!--- initialize the cache ---> <cffunction name="cacheInit" access="package" output="no" returnType="void" hint="Initializes the in-memory cache"> + <cfparam name="server.modus" default="#structNew()#"> <cfscript> ! server.modus.contentObjectCache = structNew(); ! server.modus.contentObjectCache.objectInstances = structNew(); ! server.modus.contentObjectCache.objectTypes = structNew(); </cfscript> </cffunction> *************** *** 177,198 **** cacheInit(); } ! </cfscript> ! ! ! <!--- ---> ! <!--- ---> ! <!--- ---> ! <!--- REMOVE THIS WHEN SP1 GETS INSTALLED ---> ! ! <cfreturn false> ! <!--- ---> ! <!--- ---> ! <!--- ---> ! <!--- ---> ! <!--- ---> ! ! ! ! <cfreturn structKeyExists(server.modusCache.objectInstances,arguments.id)> </cffunction> --- 178,183 ---- cacheInit(); } ! </cfscript> ! <cfreturn structKeyExists(server.modus.contentObjectCache.objectInstances,arguments.id)> </cffunction> *************** *** 201,205 **** <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> <cfscript> ! server.modusCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject; </cfscript> </cffunction> --- 186,190 ---- <cfargument name="contentObject" required="yes" type="org.bacfug.modus.baseContentObject"> <cfscript> ! server.modus.contentObjectCache.objectInstances[arguments.contentObject.getID()] = arguments.contentObject.getClone(); </cfscript> </cffunction> *************** *** 211,215 **** <cfthrow type="modus.badCacheRequest" message="Object does not exist in the cache" detail="The contentObject with ID ""#arguments.id#"" does not exist in the cache. You may not request an object that is not cached."> </cfif> ! <cfreturn server.modusCache.objectInstances[arguments.id]> </cffunction> --- 196,200 ---- <cfthrow type="modus.badCacheRequest" message="Object does not exist in the cache" detail="The contentObject with ID ""#arguments.id#"" does not exist in the cache. You may not request an object that is not cached."> </cfif> ! <cfreturn server.modus.contentObjectCache.objectInstances[arguments.id]> </cffunction> |