This morning (last night?) on cf-talk there was a good thread started about caching options in ColdFusion. While you have cfcache and query caching out of the box, there are more options out there for advanced caching. On the thread these were mentioned:
Softcache - This one is by Ashwin of the ColdFusion engineering team!
And lastly, ScopeCache - This is my own tag and it is used in BlogCFC.
Lots of options out there, and I bet there are more, so please share. And it goes without saying (I hope), that simply dropping a cache onto a page is not the way you solve performance problems. It is the "Final Solution" only and should be used if you have determined, absolutely, that there is no other way to speed up the page.
Archived Comments
Ray, when you write that "simply dropping a cache onto a page is not the way you solve performance problems", what do you mean by "dropping a cache onto a page"? Are you referring to the use of CFCACHE, or are you referring to all caching in general? I guess I'm wondering if you can expand on what you meant in that sentence.
Thanks!
I meant caching in general. This is not to say it is a bad thing. The point I was trying to get across is - if you identify process X as being slow, your first thought should NOT be, "Let me cache it", but "Can I make it quicker". -Then- you add caching if need be.
There is another thing to consider as well. I recommend that you cache CFCs in the app scope. I recommend this because creating a CFC can be slow. This is kind of a "no brainer", and since I don't have much control over the creation of a CFC, it makes sense to simply create them once.
As with most things, there is no hard and fast rule that applies 100% of the time.
Regarding caching CFCs in the app scope, would it be adequate to create the CFC with a cfparam or is their a prefered method for caching a CFC?
Thanks.
I would not use cfparam. I'd just use the onApplicationStart method, or if using old school app.cfm, put it inside a block that only runs on start up (see blogcfc's application.cfm for an example).
I have a caching mechanism that I wrote, johnnyCache, that will actually let you check your cache, and depending on the cache's existance, skip CFC processing and output the cached content at the view. I will be blogging about it soon.
ar cool.. this is solution i need. but, i wrote CFC in my life for once only. i did a few projects which enabling the clients upload the product pictures themselve though. they're freaking slow while rendering the content out from the dir or db, i realised.
but the things is, i dun understand how is Ray's code is written.
help me pls ;-(
What part of my code in particular?
hi Ray thx 4 ur reply;-)
maybe i'll know how after i'm tk a look in your blogcfc.
Have you ever played with the Java Cache ehCache. It offers a really simple and nice API. I integrated it in the onAir framework to cache method call results. The integration was really easy, it performs well and there are several great feature which are a pain to implement by yourself (e.g. overflow to disk if JVM Memory full, different caching algorithms, etc.).
It's worth trying it!
Greetings,
Jan