Skip to main content
Known Participant
December 27, 2010
Question

Too sticky pages and values in CF9

  • December 27, 2010
  • 2 replies
  • 894 views

Hello,

I'm having problems with cf cache, or maybe browser cache.

Session values won't stay between pages, I see in the debug box previous values I deleted two days ago.

Same with cfdumps (in application.cfc) that don't print anything, or changes made to webpages aren't displayed immediately on the local machine.

I have put in Application.cfc this code:

    <cfset this.sessionmanagement="true" />
    <cfset this.clientmanagement="true" />

Any hint?

Thanks!

    This topic has been closed for replies.

    2 replies

    BKBK
    Community Expert
    Community Expert
    January 2, 2011

    I suspect it's got to do with your Application.cfc file. Could you show us its content?

    SilvestroAuthor
    Known Participant
    January 5, 2011

    Sure BKBK, thanks!

    Here it is:

    <cfcomponent displayname="Application" output="true">
       
        <cfset this.name="Myapp" />
        <cfset this.sessionmanagement="true" />
        <cfset this.clientmanagement="true" />
        <cfset this.applicationTimeout = createTimeSpan( 0, 0, 5, 0 ) />
        <cfset this.sessionTimeout = createTimeSpan( 0, 0, 3, 0 ) />
        <cfset this.datasource="mydb" />
        <cfset this.googlemapkey = "blabla" />
       
        <cfset application.name="Myapp" />
       
        <cffunction name="onRequest" returntype="void" >
            <cfargument name="targetPage" type="String" required="true"  />
           
            <cfinclude template="/header.cfm" />
            <cfinclude template="#arguments.targetPage#" />
            <cfinclude template="/footer.cfm" />
           
        </cffunction>
       
       
    </cfcomponent>

    BKBK
    Community Expert
    Community Expert
    January 6, 2011

    Application name seems to occur twice. In my opinion, the sessiontimeout and applicationtimeout are too small and too close together to be practical. See if something like this helps

       
        <cfset this.name="Myapp" />
        <cfset this.sessionmanagement="true" />
      

        <cfset this.clientmanagement="true" />
        <cfset this.applicationTimeout = createTimeSpan(1, 0, 0, 0) />
        <cfset this.sessionTimeout = createTimeSpan(0, 0, 20, 0) />
        <cfset this.datasource="mydb" />
        <cfset this.googlemapkey = "blabla" />
       
        <!--- <cfset application.name="Myapp" />--->
       

    Owainnorth
    Inspiring
    December 27, 2010

    What method are you using for client storage? I've seen issues like this when using Registry, try changing it to use a database of some kind.

    Once you've visited your site, do you have a cookie for it containing your CFTOKEN and CFID? If you do, do they change on every page? If you dump out the SESSION scope on every request, does the ID change? If it does then it's a problem with either cookies in your browser or client storage on the server. If it doesn't, then there's something going on in your code possibly.

    Try breaking it down completely; create yourself an otherwise blank Application.cfc with just the settings you suggested and make that work with a single page, then start bolting your application back together until you find the problem.

    O.

    SilvestroAuthor
    Known Participant
    December 31, 2010

    Thanks Owain

    I checked page headers, they are like this:

    Request headers

    Cache-control: no cache

    Pragma: no cache

    Response headers

    Cache-control: public, max-age=86400, public, max-age=86400

    Server: jrun web server

    Seems to me it's a cache problem...