cache question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike P

    #1

    cache question

    I've read a couple of articles on cache and setting expiration etc.
    What I can't find the answer to is - if you don't set an expiration for
    your cache, what is the default? And when your cache does expire, how
    do you catch this event? For example, if I have a datagrid which is
    populated by cached data and the cached data expires, what happens when
    I try to access that datagrid?


    Any help would be much appreciated.


    Cheers,

    Mike



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • PJ

    #2
    Re: cache question

    the cache will expire when the aspnet_wp is forced to recycle

    when accessing cache data do something like this in a static method to
    retrieve the data

    string myCachedData = HttpContext.Cur rent.WebCache(" myCachedData");
    if ( myCachedData == null )
    {
    // code to put the data in the cache
    }
    return myCachedData;

    "Mike P" <mrp@telcoelect ronics.co.uk> wrote in message
    news:uewfqPnVDH A.2352@TK2MSFTN GP12.phx.gbl...[color=blue]
    > I've read a couple of articles on cache and setting expiration etc.
    > What I can't find the answer to is - if you don't set an expiration for
    > your cache, what is the default? And when your cache does expire, how
    > do you catch this event? For example, if I have a datagrid which is
    > populated by cached data and the cached data expires, what happens when
    > I try to access that datagrid?
    >
    >
    > Any help would be much appreciated.
    >
    >
    > Cheers,
    >
    > Mike
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    • Mike P

      #3
      Re: cache question

      What will cause aspnet_wp to recycle? Is it recycled when a session
      times out?

      Mike



      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Ryan Gregg

        #4
        Re: cache question

        It is recycled when
        a) an application level error occurs
        b) the server is restarted (or IIS is restarted)
        c) an application times out, meaning it hasn't been accessed in the time
        out period
        d) in IIS 6.0 all applications are recycled on a set time period (set in
        the IIS manager). I beleive the default is 29 hours.
        e) If you recompile the application, when ASP.NET notices the change, it
        recycles the application


        Ryan Gregg

        "Mike P" <mrp@telcoelect ronics.co.uk> wrote in message
        news:uOB52BoVDH A.652@tk2msftng p13.phx.gbl...[color=blue]
        > What will cause aspnet_wp to recycle? Is it recycled when a session
        > times out?
        >
        > Mike
        >
        >
        >
        > *** Sent via Developersdex http://www.developersdex.com ***
        > Don't just participate in USENET...get rewarded for it![/color]


        Comment

        • PJ

          #5
          Re: cache question

          And I believe it happens when you modify the machine.config or web.config as
          well...

          "Ryan Gregg" <rgregg@wheatla ndsystems.com> wrote in message
          news:ehXrBHrVDH A.1748@TK2MSFTN GP12.phx.gbl...[color=blue]
          > It is recycled when
          > a) an application level error occurs
          > b) the server is restarted (or IIS is restarted)
          > c) an application times out, meaning it hasn't been accessed in the[/color]
          time[color=blue]
          > out period
          > d) in IIS 6.0 all applications are recycled on a set time period (set[/color]
          in[color=blue]
          > the IIS manager). I beleive the default is 29 hours.
          > e) If you recompile the application, when ASP.NET notices the change,[/color]
          it[color=blue]
          > recycles the application
          >
          >
          > Ryan Gregg
          >
          > "Mike P" <mrp@telcoelect ronics.co.uk> wrote in message
          > news:uOB52BoVDH A.652@tk2msftng p13.phx.gbl...[color=green]
          > > What will cause aspnet_wp to recycle? Is it recycled when a session
          > > times out?
          > >
          > > Mike
          > >
          > >
          > >
          > > *** Sent via Developersdex http://www.developersdex.com ***
          > > Don't just participate in USENET...get rewarded for it![/color]
          >
          >[/color]


          Comment

          • Mike P

            #6
            Re: cache question

            So assigning something to the Cache is essentially the same as assigning
            it to a Session variable (i.e. it expires on timeout and is particular
            to the specific user and not the application)?


            Mike



            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            • Mike P

              #7
              Re: cache question

              I've done a few tests and found that Cache is Application level and not
              Session level, which I would think means that it can only be used for
              storing global variables.


              Mike



              *** Sent via Developersdex http://www.developersdex.com ***
              Don't just participate in USENET...get rewarded for it!

              Comment

              Working...