Page data caching

Discussion in 'ASP .Net' started by Mark, Nov 11, 2004.

  1. Mark

    Mark Guest

    I'm adding data to the cache with this code:
    HttpContext.Current.Cache( "Categories" ) = GetCategoriesFromDB

    The problem is wheneveeeer I modify the database, the cache doesn't change
    quickly enough. I looked at using a SQL Severer trigger to clear it by using
    a cache trigger dependency. But all I really need to do is clear it after a
    few minutes.
    Can someone guide me?
    Mark, Nov 11, 2004
    #1
    1. Advertising

  2. Mark

    Scott Allen Guest

    Hi Mark:

    If you use the Insert method, you'll have greater control over the
    expiration settings:

    Cache.Insert("Categories", GetCategoriesFromDB(), Nothing, _
    DateTime.Now.AddMinutes(2), TimeSpan.Zero)

    The above will cache the object for 2 minutes.

    --
    Scott
    http://www.OdeToCode.com/

    On Wed, 10 Nov 2004 23:50:31 -0500, "Mark" <>
    wrote:

    >I'm adding data to the cache with this code:
    >HttpContext.Current.Cache( "Categories" ) = GetCategoriesFromDB
    >
    >The problem is wheneveeeer I modify the database, the cache doesn't change
    >quickly enough. I looked at using a SQL Severer trigger to clear it by using
    >a cache trigger dependency. But all I really need to do is clear it after a
    >few minutes.
    >Can someone guide me?
    >
    Scott Allen, Nov 11, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hypo
    Replies:
    6
    Views:
    394
  2. Alex

    Page and Data Caching in .Net

    Alex, Oct 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    361
    Steve Drake
    Oct 16, 2003
  3. Troy Simpson

    Fragment Caching inside page caching?

    Troy Simpson, Jan 19, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    770
    Troy Simpson
    Jan 19, 2004
  4. JimLad
    Replies:
    3
    Views:
    904
    JimLad
    Jan 21, 2010
  5. nullref

    data grid - data caching help

    nullref, Dec 7, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    115
    nullref
    Dec 7, 2005
Loading...

Share This Page