| Package: MachII.framework.commands |
| Inherits from: framework.Command |
| A Command for performing caching. |
<!--- License: Copyright 2008 GreatBizTools, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright: GreatBizTools, LLC $Id: CacheCommand.cfc 595 2007-12-17 02:39:01Z kurtwiersma $ Created version: 1.6.0 Updated version: 1.6.0 Notes: ---> |
| Method Summary | |
|---|---|
| public CacheCommand |
init([string handlerId=""], [string cacheName=""], [string alias=""], [string criteria=""])
Initializes the command. |
| public boolean |
execute(Event event, EventContext eventContext)
Executes a caching block. |
| private string | getAlias() |
| private string | getCacheName() |
| public string | getCriteria() |
| private string | getHandlerId() |
| private void | setAlias(string alias) |
| private void | setCacheName(string cacheName) |
| private void | setCriteria(string criteria) |
| private void | setHandlerId(string handlerId) |
| Methods inherited from framework.Command: setParameters , getParameter , setLog , setParameter , getLog |
|---|
| Method Detail |
|---|
| execute |
|---|
public boolean execute( Event event, EventContext eventContext )
Executes a caching block.
Parameters:
| Event event |
| EventContext eventContext |
Code:
<cffunction name="execute" access="public" returntype="boolean" output="true"
hint="Executes a caching block.">
<cfargument name="event" type="MachII.framework.Event" required="true" />
<cfargument name="eventContext" type="MachII.framework.EventContext" required="true" />
<cfset var continue = true />
<cfset var cacheManager = arguments.eventContext.getAppManager().getCacheManager() />
<cfset var cacheHandler = "" />
<cfset var log = getLog() />
<cfif log.isDebugEnabled()>
<cfset log.debug("Cache-handler '#getHandlerId()#' in module named '#arguments.eventContext.getAppManager().getModuleName()#' beginning execution.") />
</cfif>
<cfset cacheHandler = cacheManager.getCacheHandler(getHandlerId()) />
<cfset continue = cacheHandler.handleCache(arguments.event, arguments.eventContext) />
<cfif log.isWarnEnabled() AND NOT continue>
<cfset log.warn("Cache-handler '#getHandlerId()#' has changed the flow of this event.") />
</cfif>
<cfif log.isDebugEnabled()>
<cfset log.debug("Cache-handler '#getHandlerId()#' in module named '#arguments.eventContext.getAppManager().getModuleName()#' has ended.") />
</cfif>
<cfreturn continue />
</cffunction>
| getAlias |
|---|
private string getAlias( )
Parameters:
Code:
<cffunction name="getAlias" access="private" returntype="string" output="false"> <cfreturn variables.alias /> </cffunction>
| getCacheName |
|---|
private string getCacheName( )
Parameters:
Code:
<cffunction name="getCacheName" access="private" returntype="string" output="false"> <cfreturn variables.cacheName /> </cffunction>
| getCriteria |
|---|
public string getCriteria( )
Parameters:
Code:
<cffunction name="getCriteria" access="public" returntype="string" output="false"> <cfreturn variables.criteria /> </cffunction>
| getHandlerId |
|---|
private string getHandlerId( )
Parameters:
Code:
<cffunction name="getHandlerId" access="private" returntype="string" output="false"> <cfreturn variables.handlerId /> </cffunction>
| init |
|---|
public CacheCommand init( [string handlerId=""], [string cacheName=""], [string alias=""], [string criteria=""] )
Initializes the command.
Parameters:
| [string handlerId=""] |
| [string cacheName=""] |
| [string alias=""] |
| [string criteria=""] |
Code:
<cffunction name="init" access="public" returntype="CacheCommand" output="false" hint="Initializes the command."> <cfargument name="handlerId" type="string" required="false" default="" /> <cfargument name="cacheName" type="string" required="false" default="" /> <cfargument name="alias" type="string" required="false" default="" /> <cfargument name="criteria" type="string" required="false" default="" /> <cfset setHandlerId(arguments.handlerId) /> <cfset setAlias(arguments.alias) /> <cfset setCacheName(arguments.cacheName) /> <cfset setCriteria(arguments.criteria) /> <cfreturn this /> </cffunction>
| setAlias |
|---|
private void setAlias( string alias )
Parameters:
| string alias |
Code:
<cffunction name="setAlias" access="private" returntype="void" output="false"> <cfargument name="alias" type="string" required="true" /> <cfset variables.alias = arguments.alias /> </cffunction>
| setCacheName |
|---|
private void setCacheName( string cacheName )
Parameters:
| string cacheName |
Code:
<cffunction name="setCacheName" access="private" returntype="void" output="false"> <cfargument name="cacheName" type="string" required="true" /> <cfset variables.cacheName = arguments.cacheName /> </cffunction>
| setCriteria |
|---|
private void setCriteria( string criteria )
Parameters:
| string criteria |
Code:
<cffunction name="setCriteria" access="private" returntype="void" output="false"> <cfargument name="criteria" type="string" required="true" /> <cfset variables.criteria = arguments.criteria /> </cffunction>
| setHandlerId |
|---|
private void setHandlerId( string handlerId )
Parameters:
| string handlerId |
Code:
<cffunction name="setHandlerId" access="private" returntype="void" output="false"> <cfargument name="handlerId" type="string" required="true" /> <cfset variables.handlerId = arguments.handlerId /> </cffunction>