• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Problems with <cfcache>

New Here ,
Jul 12, 2006 Jul 12, 2006

Copy link to clipboard

Copied

Hi there. I cached a page (client side) and the the following code is not flushing the cache.

<cfcache timeout="#createtimespan(-1,0,0,0)#" action="clientcache">
<cfcache action="flush">

I had the following script to either cache or flush the script and that didn't work either. No errors were thrown, it just cached it the first time and didn't uncache it after the session var was changed to 1. here is the code

<cfparam name="SESSION.clearCacheLink" default="0">
<cfif SESSION.clearCacheLink>
<cfcache timespan="#createtimespan(-1,0,0,0)#">
<cflock scope="session" timeout="10">
<cfset SESSION.clearCacheLink = 0>
</cflock>
<cfelse>
<cfcache action="clientcache" timeout="#createtimespan(0,1,0,0)#">
</cfif>
TOPICS
Advanced techniques

Views

686

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 12, 2006 Jul 12, 2006

Copy link to clipboard

Copied

Maybe my problem is the page is getting cached so that when the user requests the page again it doesn't run my session.clearCacheLink variable and doesn't reset the cache. Does this make sense?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 12, 2006 Jul 12, 2006

Copy link to clipboard

Copied

When the browser caches a page, it doesn't re-request the page from the server until the timespan has passed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 13, 2006 Jul 13, 2006

Copy link to clipboard

Copied

Hmmm... then how do I force it to be re-requested. <cfcache action="flush"> isn't working for me and I tried a <cfcache with a negative timeout, that didn't work either. When the cache is flushed does it do it for the entire site, or only in the directory that the code is run in. In my case they are in two different directories. Thanks for your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 13, 2006 Jul 13, 2006

Copy link to clipboard

Copied

> then how do I force it to be re-requested.

You can't. If you send a page to a browser that allows caching (the page, not the browser), and you specify a cache timeout, that page won't be re-requested no matter what you do on the server. Your only option is to wait until the cache timeout passes.

If that isn't acceptable, then don't allow caching of your pages. That way, the user's browser re-requests the page every single time it is accessed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 13, 2006 Jul 13, 2006

Copy link to clipboard

Copied

There must be some way to do this. <cfcache action="flush"> seems to be the answer but it doesn't work for me. What is this supposed to do? Does it only flush server-side caching? Could I cache something on the serverside even though there are dynamic variables that dictate the content of the page? I remember hearing that client side caching should be used in this instance. We have a CMS used for the management of may sites and some clients have more than one site with us. In a perfect situation when they change their site id, I would flush the cache so that their individual pages would be processed and delivered properly (otherwise they get the cached page of the previous site). Any other ideas are greatly appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 13, 2006 Jul 13, 2006

Copy link to clipboard

Copied

Read the 2nd paragraph of this page:
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-pa8.htm#wp1097532
"Use this tag if it is not necessary to get dynamic content each time a user accesses a page."

If you have a page that is accessed with the same exact URL, but displays different content, then you simply can't use <cfcache>.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 11, 2006 Aug 11, 2006

Copy link to clipboard

Copied

LATEST
hi there
i dun quite understand how flush works.
at first, an action="cache" will create a new cache(.tmp) on the server, then,
after the action="flush", the cache(.tmp) on server will replace with a new one?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 13, 2006 Jul 13, 2006

Copy link to clipboard

Copied

Thanks Kronin, its sad news but at least it is difinitive.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation