Changeset 781

Show
Ignore:
Timestamp:
05/12/2008 07:39:10 PM (14 months ago)
Author:
peterfarrell
Message:

- Removed use of UUID for cache handler id and used a pseudo-random generator to generate the id (about 2,000% faster than using UUID)

Location:
framework/1-6-0/trunk/framework
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • framework/1-6-0/trunk/framework/CacheHandler.cfc

    r768 r781  
    3333        ---> 
    3434        <cfset variables.commands = ArrayNew(1) /> 
    35         <cfset variables.handlerId = CreateUUID() /> 
     35        <cfset variables.handlerId = "" /> 
    3636        <cfset variables.alias = ""/> 
    3737        <cfset variables.cacheName = "" /> 
     
    5555                <cfargument name="parentHandlerType" type="string" required="false" default="" /> 
    5656         
    57                 <!--- run setters ---> 
     57                <!--- Run setters ---> 
    5858                <cfset setAlias(arguments.alias) /> 
    5959                <cfset setCacheName(arguments.cacheName) /> 
     
    6161                <cfset setParentHandlerName(arguments.parentHandlerName) /> 
    6262                <cfset setParentHandlerType(arguments.parentHandlerType) /> 
     63                <cfset setHandlerId(createHandlerId()) /> 
    6364                 
    6465                <cfreturn this /> 
     
    290291        </cffunction> 
    291292         
     293        <cffunction name="createHandlerId" access="private" returntype="string" output="false" 
     294                hint="Creates a random handler id. Does not use UUID for performance reasons."> 
     295                <cfreturn Hash(getTickCount() & RandRange(0, 100000))/> 
     296        </cffunction> 
     297         
    292298        <!--- 
    293299        ACCESSORS 
    294300        ---> 
    295         <cffunction name="getHandlerId" access="public" returntype="uuid" output="false" 
     301        <cffunction name="setHandlerId" access="private" returntype="void" output="false"> 
     302                <cfargument name="handlerId" type="string" required="true" /> 
     303                <cfset variables.handlerId = arguments.handlerId /> 
     304        </cffunction> 
     305        <cffunction name="getHandlerId" access="public" returntype="string" output="false" 
    296306                hint="Returns the handler id."> 
    297307                <cfreturn variables.handlerId /> 
  • framework/1-6-0/trunk/framework/CacheManager.cfc

    r780 r781  
    6767        </cffunction> 
    6868         
    69         <cffunction name="loadCacheHandlerFromXml" access="public" returntype="uuid" output="false" 
     69        <cffunction name="loadCacheHandlerFromXml" access="public" returntype="string" output="false" 
    7070                hint="Loads a cache handler from Xml."> 
    7171                <cfargument name="configXML" type="string" required="true" /> 
     
    172172 
    173173                <!--- Add the handler ---> 
    174                 <cfset variables.handlers[handlerId] = arguments.cacheHandler /> 
     174                <cfset StructInsert(variables.handlers, handlerId, arguments.cacheHandler, false) /> 
    175175                 
    176176                <!--- Register the handler by handler type ---> 
  • framework/1-6-0/trunk/framework/commands/CacheCommand.cfc

    r771 r781  
    4343        <cffunction name="init" access="public" returntype="CacheCommand" output="false" 
    4444                hint="Initializes the command."> 
    45                 <cfargument name="handlerId" type="uuid" required="false" default="#CreateUUID()#" /> 
     45                <cfargument name="handlerId" type="string" required="false" default="#CreateUUID()#" /> 
    4646                <cfargument name="cacheName" type="string" required="false" default="" /> 
    4747                <cfargument name="alias" type="string" required="false" default="" /> 
     
    9191        ---> 
    9292        <cffunction name="setHandlerId" access="private" returntype="void" output="false"> 
    93                 <cfargument name="handlerId" type="uuid" required="true" /> 
     93                <cfargument name="handlerId" type="string" required="true" /> 
    9494                <cfset variables.handlerId = arguments.handlerId /> 
    9595        </cffunction> 
    96         <cffunction name="getHandlerId" access="private" returntype="uuid" output="false"> 
     96        <cffunction name="getHandlerId" access="private" returntype="string" output="false"> 
    9797                <cfreturn variables.handlerId /> 
    9898        </cffunction>