SCCFUG Winter 2002 Conference: Advance Caching Techniques
SCCFUG Winter 2002 Conference: Advance Caching Techniques
Advance Caching
Techniques
Keen Haynes
MKAD
[email protected]
Introduction
• What is caching?
• Why is it important to me?
• What can I cache?
• How do I leverage caching
Introduction (cont.)
• Template Cache
• Trusted Cache
• Database Connection Cache or Pooling
• Query Caching
Template Cache
<cfcache
action = "cache" or "flush" or "clientCache" or "optimal"
username = "username"
password = "password"
protocol = "protocol name"
timeout = “timeout date-time"
directory = "directory name for map file"
cacheDirectory =“directory name for cached pages"
expireURL = "wildcarded URL reference"
port = "port-number">
<CFCACHE> (cont.)
• Client-side caching
<CFCACHE ACTION=“CLIENTCACHE”
• Server-side caching
<CFCACHE ACTION=“CACHE”
• Optimal – combination of client & server
<CFCACHE ACTION=“OPTIMAL”
• Refresh a cached page
<CFCACHE ACTION=“FLUSH”
<CFCACHE> (cont.)
<CFCACHE ACTION=“CACHE”
TIMEOUT=“#DateAdd(“h”, “-4”,
Now())#”>
<CFCACHE ACTION=“FLUSH”
EXPIREURL=“Customer.cfm?*”
Trusted Cache
Points to remember:
• Queries are cached on a server-wide basis
• Documentation states query must use same
SQL statement, data source, query name, user
name, password, and DBTYPE (I did not find
this to be true for query name )
• SQL statements must be exactly the same –
this includes even tabbing
Caching and database queries (cont)
• Things to consider
– Overhead
– Need for “current” information
• Identify candidates for caching – both long
running and frequently called queries and
templates
• Testing to verify expected results
<CFQUESTIONS>
?
</CFQUESTIONS>