Adobe COLDFUSION 9 Manual page 595

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
One important thing to understand here is that
time for a artist. It actually means that 10 artwork collections (artworks for 10 artists) are loaded together.
When you call
getarts()
asked for.
The value for
batchsize
uninitialized collections in the session.
Caching
Caching is extensively used for optimizing database applications and effectively reducing traffic between the database
and the application.
ColdFusion ORM supports two levels of caching:
• Session level
• Secondary level
Session level cache
Objects that are loaded from the database are always cached in the ORM Session as long as the session is open. When
is called to retrieve an object in a session for the first time, ORM fetches the data from the database and
EntityLoad
constructs the object. In any subsequent call to load the same object in the same session, ORM fetches the object from
the session cache. To forcefully retrieve the object from the database,
For more details on ORM Sessions and its lifecycle, see
on page 537.
Secondary level cache
ColdFusion provides the ability to store the data that is retrieved from the database in secondary cache. The contents
in secondary cache live longer than the life-time of a session. It can also be the life-time of the process or in-definite
(disk-caching), depending on the ability of the secondary cache provider. The cache can also be used in a distributed
environment depending on the ability of the secondary cache provider.
An important difference between session level cache and secondary level cache is that the session level caches the whole
object but the secondary level caches only the data.
Secondary level cache can be leveraged by using an external cache provider with ColdFusion ORM. EHCache,
JBossCache, OSCache, SwarmCache, and Tangosol Coherence Cache are some popular secondary cache providers,
which can be plugged into Hibernate.
ColdFusion uses EHCache as the default secondary cache provider. EHCache is a distributed caching solution that
supports memory and disk-based caching. EHCache can be configured using a configuration file. Different cache
regions can be defined in the configuration file. Each cache region has its own configuration that specifies details
including the number of elements it can store, eviction policy, time to live (ttl), and idle time.
ehcache.xml is available in the following location: CF_root\lib\. For details of the properties in the ehcache.xml, refer
to the documentation available at the following URL:
http://ehcache.org/
The following is a sample EHCache configuration file (
batchsize
on the first artist, artworks for 9 other artists are also fetched along with the one that was
attribute should be chosen based on the expected number of proxied objects or
"ORM session
ehcache.xml
Last updated 8/5/2010
here does not mean that 10 artworks are loaded at one
should be called on the object.
EntityReload
management" on page 595 and "Architecture"
):
590

Advertisement

Table of Contents
loading

Table of Contents