Skip to content
misterdai edited this page Jul 30, 2012 · 3 revisions

Introduction

The base components of CfTracker are designed so they can be used externally to the CfTracker application. Each component is tied to an aspect of the server (applications, sessions, query cache, threads, template cache, stats).

applications.cfc

Description

This component allows you to access information, settings and scopes of active applications. You can also perform actions like stop, restart and refresh.

Warning

When using the getScope() method, any activity against what is returned will update the last accessed time. This can be dangerous to rely on as it could keep an application alive unintentionally, when it might normally timeout due to inactivity. Use getScopeValues() if you want to access values within the scope. This method should only be used if you’re doing something that requires the complete application itself or you want to change a value within the application.

Methods
  <th>
    Parameters
  </th>
  
  <th>
    Returns
  </th>
  
  <th>
    Description
  </th>
</tr>

<tr>
  <th scope="row">
    init()
  </th>
  
  <td>
     
  </td>
  
  <td>
    cfc
  </td>
  
  <td>
    Required for setting up private internal Java objects
  </td>
</tr>

<tr>
  <th scope="row">
    getApps()
  </th>
  
  <td>
     
  </td>
  
  <td>
    array
  </td>
  
  <td>
    Returns an array of all active application names
  </td>
</tr>

<tr>
  <th scope="row">
    getScope()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Retrieves the application scope
  </td>
</tr>

<tr>
  <th scope="row">
    getScopeKeys()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    array
  </td>
  
  <td>
    Array of application scope keys
  </td>
</tr>

<tr>
  <th scope="row">
    getScopeValues()
  </th>
  
  <td>
    appName{string} [, keys{array}]
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Copies of all or requested scope values, these won’t change the last accessed time
  </td>
</tr>

<tr>
  <th scope="row">
    getSettings()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Get the application settings and events
  </td>
</tr>

<tr>
  <th scope="row">
    stop()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Stops an application and removes it
  </td>
</tr>

<tr>
  <th scope="row">
    restart()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Restarts an application by flagging onApplicationStart to run on next request
  </td>
</tr>

<tr>
  <th scope="row">
    touch()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Updates the last accessed date
  </td>
</tr>

<tr>
  <th scope="row">
    getInfo()
  </th>
  
  <td>
    appName{string} [, aspects{string}]
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Returns all or the specified information about the application
  </td>
</tr>

<tr>
  <th scope="row">
    getAppsInfo()
  </th>
  
  <td>
     
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Returns all information about every active application
  </td>
</tr>

<tr>
  <th scope="row">
    getIsInited()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of the IsInited flag (shows if onApplicationStart has run) and application existance
  </td>
</tr>

<tr>
  <th scope="row">
    getTimeAlive()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of the time alive and application existance
  </td>
</tr>

<tr>
  <th scope="row">
    getLastAccessed()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of the last accessed time and application existance
  </td>
</tr>

<tr>
  <th scope="row">
    getIdleTimeout()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of the timeout date and application existance
  </td>
</tr>

<tr>
  <th scope="row">
    getExpired()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of the expired flag (shows if is waiting for garbage collection) and application existance
  </td>
</tr>

<tr>
  <th scope="row">
    getIdlePercent()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of the percent progress to expirying and application existance
  </td>
</tr>

<tr>
  <th scope="row">
    getIdlePercent()
  </th>
  
  <td>
    appName{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of the number of application sessions and application existance
  </td>
</tr>
Method

querycache.cfc

Description

Gives you access to perform actions against the Query Cache and retrieve information.

Methods
  <th>
    Parameters
  </th>
  
  <th>
    Returns
  </th>
  
  <th>
    Description
  </th>
</tr>

<tr>
  <th scope="row">
    init()
  </th>
  
  <td>
     
  </td>
  
  <td>
    cfc
  </td>
  
  <td>
    Required for setting up private internal Java objects
  </td>
</tr>

<tr>
  <th scope="row">
    getQueries()
  </th>
  
  <td>
     
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Structure of cached queries, keys equal hashcodes for identification
  </td>
</tr>

<tr>
  <th scope="row">
    getInfo()
  </th>
  
  <td>
    id{string}
  </td>
  
  <td>
    false/struct
  </td>
  
  <td>
    Retrieves information about the query cache item or false if it no longer exists
  </td>
</tr>

<tr>
  <th scope="row">
    getResult()
  </th>
  
  <td>
    id{string}
  </td>
  
  <td>
    false/struct
  </td>
  
  <td>
    Result set of the query item or false if it no longer exists
  </td>
</tr>

<tr>
  <th scope="row">
    purge()
  </th>
  
  <td>
    id{string}
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Purge an item from the query cache
  </td>
</tr>

<tr>
  <th scope="row">
    purgeAll()
  </th>
  
  <td>
     
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Purge all items from the query cache
  </td>
</tr>

<tr>
  <th scope="row">
    refresh()
  </th>
  
  <td>
    id{string}
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Updates the creation time of the item to now
  </td>
</tr>

<tr>
  <th scope="row">
    getCount()
  </th>
  
  <td>
     
  </td>
  
  <td>
    numeric
  </td>
  
  <td>
    Number of items in the query cache
  </td>
</tr>

<tr>
  <th scope="row">
    getMaxCount()
  </th>
  
  <td>
     
  </td>
  
  <td>
    numeric
  </td>
  
  <td>
    Maximum number of items allowed in the query cache
  </td>
</tr>

<tr>
  <th scope="row">
    getHitRatio()
  </th>
  
  <td>
     
  </td>
  
  <td>
    numeric
  </td>
  
  <td>
    Overall hit ratio of the query cache
  </td>
</tr>
Method

sessions.cfc

Description

Provides access to all sessions on the server, information against them and the ability to perform certain actions.

Warning

When using the getScope() method, any activity against what is returned will update the last accessed time. This can be dangerous to rely on as it could keep a session alive unintentionally, when it might normally timeout due to inactivity. One example of this would be looping through each session, getting the scope using getScope() and then checking for a certain value. This would cause every session’s last accessed time to be updated, keeping those sessions alive and bogging down your server with unused sessions.

Use getScopeValues() if you want to access values within the scope. This method should only be used if you’re doing something that requires the complete session itself or you want to change a value within the session.

Methods
  <th>
    Parameters
  </th>
  
  <th>
    Returns
  </th>
  
  <th>
    Description
  </th>
</tr>

<tr>
  <th scope="row">
    init()
  </th>
  
  <td>
     
  </td>
  
  <td>
    cfc
  </td>
  
  <td>
    Required for setting up private internal Java objects
  </td>
</tr>

<tr>
  <th scope="row">
    getSessions()
  </th>
  
  <td>
    [appName{string}]
  </td>
  
  <td>
    array
  </td>
  
  <td>
    Array of session keys. If an application name is provided, the sessions keys are for that application only.
  </td>
</tr>

<tr>
  <th scope="row">
    getCount()
  </th>
  
  <td>
    [appName{string}]
  </td>
  
  <td>
    numeric
  </td>
  
  <td>
    Total number of sessions. If an application name is provided, this is the count of sessions for it.
  </td>
</tr>

<tr>
  <th scope="row">
    getScope()
  </th>
  
  <td>
    sessId{string}
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Actual session scope of the ID provided. <strong>WARNING:</strong> using this directly will update the last accessed time of the session.
  </td>
</tr>

<tr>
  <th scope="row">
    getScopeKeys()
  </th>
  
  <td>
    sessId{string}
  </td>
  
  <td>
    array
  </td>
  
  <td>
    Returns an array of keys for the session scope.
  </td>
</tr>

<tr>
  <th scope="row">
    getScopeValues()
  </th>
  
  <td>
    sessId{string} [, keys{array}]
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Retrieves session scope values, without affecting the last accessed time.
  </td>
</tr>

<tr>
  <th scope="row">
    stop()
  </th>
  
  <td>
    sessId{string}
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Stops the session by cleaning it up. This removes it from the session storage, forcing creation of a new session upon the next request received.
  </td>
</tr>

<tr>
  <th scope="row">
    touch()
  </th>
  
  <td>
    sessId{string}
  </td>
  
  <td>
    boolean
  </td>
  
  <td>
    Updates the last accessed time of the session to now.
  </td>
</tr>

<tr>
  <th scope="row">
    getInfo()
  </th>
  
  <td>
    [sessId{string}, aspects{string}]
  </td>
  
  <td>
    struct
  </td>
  
  <td>
    Retrieve's all metadata information about a session, without updating its last accessed timestamp. If a sessId is provided, a structure is returned for that single session, otherwise a struct for all sessions is returned.
  </td>
</tr>

<tr>
  <th scope="row">
    init()
  </th>
  
  <td>
     
  </td>
  
  <td>
    cfc
  </td>
  
  <td>
    Required for setting up private internal Java objects
  </td>
</tr>
Method

stats.cfc

Description

Attempts to retrieve statistics about the Coldfusion server.

Methods
  <th>
    Parameters
  </th>
  
  <th>
    Returns
  </th>
  
  <th>
    Description
  </th>
</tr>

<tr>
  <th scope="row">
    init()
  </th>
  
  <td>
     
  </td>
  
  <td>
    cfc
  </td>
  
  <td>
    Required for setting up private internal Java objects
  </td>
</tr>
Method

templatecache.cfc

Description

Provides minor information about the template cache.

Methods
  <th>
    Parameters
  </th>
  
  <th>
    Returns
  </th>
  
  <th>
    Description
  </th>
</tr>

<tr>
  <th scope="row">
    init()
  </th>
  
  <td>
     
  </td>
  
  <td>
    cfc
  </td>
  
  <td>
    Required for setting up private internal Java objects
  </td>
</tr>
Method

threads.cfc

Description

Provides information about all threads involved in the Coldfusion server.

Methods
  <th>
    Parameters
  </th>
  
  <th>
    Returns
  </th>
  
  <th>
    Description
  </th>
</tr>

<tr>
  <th scope="row">
    init()
  </th>
  
  <td>
     
  </td>
  
  <td>
    cfc
  </td>
  
  <td>
    Required for setting up private internal Java objects
  </td>
</tr>
Method