Adobe COLDFUSION 9 Manual page 599

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

Advertisement

594
DEVELOPING COLDFUSION 9 APPLICATIONS
ColdFusion ORM
Step 3:
<cfscript>
//This will cache the Artist Component and also the association.
It wouldn't cache the Art
objects.
artistObj = EntityLoad("CArtists", 3, true);
//This will cache the query.
availableArts = ORMExecuteQuery("from CArt where issold=0", {}, false, {cacheable=true,
cachename="availableArtsCache"});
</cfscript>
Evict content from secondary cache
ColdFusion provides the following methods to evict contents from the secondary cache.
ORMEvictEntity("<component_name>", [primarykey])
This method is used to evict items for the given component name, from the secondary cache. If the primary key is
specified, then the data of the entity with that primary key is evicted. Primary key should be a value in case of simple
primary key or should be a struct in case of composite primary key.
Example:
<cfset ORMEvictEntity("CArtists")>
Evicts all the cache data of CArtist entity.
<cfset ORMEvictEntity("CArtists", 1)>
Evicts the cache data of CArtists entity whose primary key is 1.
ORMEvictCollection("<component_name>", "<collection_name>", [primarykey])
This method is used to evict all the collection/association data for the given component name and collection name,
from the secondary cache. If the primary key is specified, then, the collection or association data of the entity with the
primary key is evicted.
Example:
<cfset ORMEvictCollection("CArtists", "art")>
Evicts all the association or collection data of collection art belonging to the component CArtists.
<cfset ORMEvictCollection("CArtists", "art", 1)>
Evict the association or collection data of collection art belonging to the component CArtists with primary key 1.
ORMEvictQueries([cachename])
This method is used to evict the data of all the queries from the default query cache. If cache name is specified, then,
the data of all the queries belonging to the cache region with the given cache name are evicted. Example:
<cfset ORMEvictQueries()>
Evicts the data of all the queries from the default query cache.
<cfset ORMEvictQueries("availableArtsCache")>
Evicts the data of all the queries from the cache region with the name
.
availableArtsCache
Support for user-defined caches in ColdFusion 9.0.1
Except in
and
user-defined caches are supported in all caching
cacheSetProperties
cacheGetProperties,
functions.
Last updated 8/5/2010

Advertisement

Table of Contents
loading

Table of Contents