Copy link to clipboard
Copied
What effect if any does clearing out the cache have on session variables?
Also, is anyone aware of any potential adverse side effects on user experience when clearing out the cache durring normal business hours?
Thank you,
Mike
Copy link to clipboard
Copied
What cache are you talking about? There are quite a few, notably query and template.
I would assume you mean template caching. Then that is a bit of a trick question.
I cannot imagine circumstances where clearing the cache will affect session variables. For a start, you would have cached only pages that have static content. You wouldn't have cached pages containing session variables, as these are dynamic content.
So, assuming you cached only pages containing static content, as you should have, clearing the cache wont affect session variables. However, request performance will decrease. It is therefore advisable to clear the cache when there is little activity at your site.
Copy link to clipboard
Copied
I would assume you mean template caching. [...]
[...]. For a start, you would have cached only pages that have static content. You wouldn't have cached pages containing session variables, as these are dynamic content.
How do you mean? The template cache caches compiled CFM (and CFC) templates in RAM. What's that got to do with static / dynamic content?
--
Adam
Copy link to clipboard
Copied
The template cache caches compiled CFM (and CFC) templates in RAM. What's that got to do with static / dynamic content?
I have used the term the template cache as a synonym of page cache. Template cache doesn't do the caching, as you suggest; it is the cache.
If a template's content changes constantly, that is, if it has dynamic content, that will defeat the purpose of Coldfusion caching it. It doesn't matter how or where Coldfusion caches CFM and CFC templates. Caching is for templates that change infrequently or, ideally, that are unchanging or static. The same goes for Coldfusion's caching of connections, queries, etc..
Copy link to clipboard
Copied
The template cache caches compiled CFM (and CFC) templates in RAM. What's that got to do with static / dynamic content?I have used the term the template cache as a synonym of page cache.
Right. So differently from how CF uses the term. That's a bit confusing isn't it?
Template cache doesn't do the caching, as you suggest; it is the cache.
I think you're splitting hairs "a bit" there. What would you call the mechanism that puts the cached CF templates into the template cache then?
If a template's content changes constantly, that is, if it has dynamic content, that will defeat the purpose of Coldfusion caching it. It doesn't matter how or where Coldfusion caches CFM and CFC templates. Caching is for templates that change infrequently or, ideally, that are unchanging or static. The same goes for Coldfusion's caching of connections, queries, etc..
Well yes, I suppose if one is continually writing CFML to templates dynamically before calling them with <cfinclude> or something, it does defeat the purpose of the template cache slightly. This describes a shrinkingly insignificant proportion of template requests though, in any sanely-built system. However the template cache caters for that eventuality as much as it can by weighting the usage of the templates in the cache. If it runs out of space in the cache, it cycles out the least-used templates first.
--
Adam
Copy link to clipboard
Copied
@Adam Cameron
You asked me this question:
The template cache caches compiled CFM (and CFC) templates in RAM. What's that got to do with static / dynamic content?
The keywords in your question are static and dynamic. I have answered the question in full. You swim along with the answer, but you don't acknowledge it.
I think you're splitting hairs "a bit" there.
No, I'm not. Words can affect how we think.
I would stay with "the template cache is a cache of templates", rather than "the template cache caches templates". I would also think of compiled CFM and CFC templates as being cached in a physical location like a directory on the browser or server, rather than in RAM.
What would you call the mechanism that puts the cached CF templates into the template cache then?
Coldfusion.