From: <ndi...@us...> - 2002-10-05 01:05:14
|
Update of /cvsroot/modus/org/bacfug/modus/persistence In directory usw-pr-cvs1:/tmp/cvs-serv2786/bacfug/modus/persistence Modified Files: simplefilesystempersister.cfc Log Message: put the caching in the getAll() method. It is now MUCH faster!! Index: simplefilesystempersister.cfc =================================================================== RCS file: /cvsroot/modus/org/bacfug/modus/persistence/simplefilesystempersister.cfc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** simplefilesystempersister.cfc 5 Oct 2002 00:53:01 -0000 1.2 --- simplefilesystempersister.cfc 5 Oct 2002 01:05:12 -0000 1.3 *************** *** 76,79 **** --- 76,81 ---- <cfset var filter = "*"> <cfset var dirToCheck = getBaseStorageDirectory()> + <cfset var objectID = ""> + <cfset var objectInstance = ""> <cfscript> //if a type is passed, set the filter *************** *** 86,90 **** <!--- loop through files, parsing them and putting the contents into the objectArray ---> <cfloop query="getQuery"> ! <cfset objectArray[currentRow] = getObjectFromFile(name)> </cfloop> <!--- return the array of objects ---> --- 88,99 ---- <!--- loop through files, parsing them and putting the contents into the objectArray ---> <cfloop query="getQuery"> ! <cfset objectID = getObjectIDFromFileName(name)> ! <cfif instance.cache.isObjectCached(objectID)> ! <cfset objectInstance = instance.cache.getObject(objectID)> ! <cfelse> ! <cfset objectInstance = getObjectFromFile(name)> ! <cfset instance.cache.putObject(objectInstance)> ! </cfif> ! <cfset objectArray[currentRow] = objectInstance> </cfloop> <!--- return the array of objects ---> *************** *** 124,127 **** --- 133,141 ---- <!--- now, be sure ---> <cfreturn fullPath> + </cffunction> + <!--- gets the ID from a file name ---> + <cffunction name="getObjectIDFromFileName" access="private" returnType="string" output="no" hint="returns the ID of an object based on the file in the persistence"> + <cfargument name="fileName" required="yes" type="string"> + <cfreturn listFirst(fileName,".")> </cffunction> <!--- a method to get the base directory for storage ---> |