Documentation Incomplete
These are notes during the beta cycle only and are not complete – examples may not reflect best practice with respect to the final release of the 4.0 code base.
Broker Overview
The object broker is a super piece of caching technology for the integrated ORM of FarCry Core. In simple terms it speeds up the access to data in the database by only retrieving the data once, then using in memory storage to provide fast access for subsequent requests. You really want to turn this on. The goodness provided is only limited by the the memory available to your ColdFusion instance.
Objectbroker manages the population and refreshing of its cache. You don't really need to do anything more than activate the service for the specific content types you desire.
In addition to specific database calls, object broker can also manage caching of all views. A view is like a fragment of output, such as HTML. Generally a page request is made up of one or more views. Objectbrokers webskin cache will even keep track of embedded views, flushing all the relevant views whenever a relevant content item is changed. This ensures that your changes are directly reflected in the view without having to be involved in any complex cache management.
How to activate the ObjectBroker
The object broker is activated by adding component level metadata to your content type.
<cfcomponent extends="farcry.core.packages.types.versions" displayname="Article" hint="Standard article used in the site." bObjectBroker="true" objectbrokermaxobjects="10000" lObjectBrokerWebskins="display*">
bObjectBroker
True activates object level caching for the specific content type. The default if you do not specify this attribute is false.
objectbrokermaxobjects
The maximum number of objects to be held in the broker for this content type. The default if you do not specify this attribute is 100. Typically you want to set this to a number that is high enough to hold all the records for this content type. The only reason not to is if you lack enough physical memory on the ColdFusion instance to accommodate them.
lObjectBrokerWebskins
A list of webskins that should be cached. The default time for any webskin cache is 24 hours. This seems like a long time, but remember they get automatically flushed if content within the view is updated.
You can list the webskin templates by name, for example:
lObjectBrokerWebskins="displayTeaserFeature,displayPageStandard"
You can list the webskin templates using a wildcard, for example:
lObjectBrokerWebskins="display*"
Object Broker Webtop Report
You can check which content types have been activated for the object broker by running the Objectbroker Report in the webtop Admin section. This should indicate those content types using the objectbroker, there maximum threshold and the current number of objects in the broker.
Basic process flow
- on fourq.getData() calls
- check typename.objectpool for UUID
- if present
- return struct
- if not,
- make dbgateway call
- check if room in objectpool
- purge/update aobjects FIFO list as required
- update objectpool with object struct
- return struct
- update cache stats (no cache stats implemented at this time 20070505)
- if present
- check typename.objectpool for UUID
- return object struct to content type call exactly as per original
In memory structure of object broker
application |
||||
- |
objectbroker |
|||
- |
- |
typename |
||
- |
- |
- |
objectpool |
(structure, keyed by OBJECTID, of content item structures) |
- |
- |
- |
objectpool |
stobj |
- |
- |
- |
objectpool |
stwebskins(structure keyed by template name and/or url hash |
- |
- |
- |
aObjects |
(manage object pooling by FIFO) |
- |
- |
- |
maxobjects |
(maximum number of objects to cache) |