Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to use CFCACHE to cache my SQL query ?

Posted on 2001-08-21
2
Medium Priority
?
194 Views
Last Modified: 2013-12-24
Can anybody tell me how to use CFCACHE to cache my SQL query ?

I have a home page which will do a CFQUERY on a news update table but I would like to cache it so that everytime someone load the home page, it will not always doing the CFQUERY but getting the data from the cache file, if there is. I can't find it explain very well in ColdFusion help file.

Is there any sample scripts out there ?
0
Comment
Question by:ck969
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
cheekycj earned 200 total points
ID: 6409850
CFCACHE is meant for content not queries.  If you have a dynamic page but can be cached when it has the URL params or something similar that is when you should use CFCACHE.

For caching queries use this:
<CFQUERY DATASOURCE="yourdsn" NAME="MyCachedQuery" CACHEDWITHIN="#CreateTimeSpan(0, 1, 0, 0)#">
   SELECT *
     FROM SomeTable;
</CFQUERY>

This caches the query for an hour.  You can change it as you need it.. the parameters are dd, hh, mm, ss for CreateTimeSpan.

CJ
0
 

Expert Comment

by:SpideyMod
ID: 8096549
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question