Cache expiration

Discussion in 'ASP .Net' started by Steffen Loringer, Oct 14, 2004.

  1. Hi,

    i like to store some data in the Cache on the server. The data should be
    removed once a file on the server is changed (I'm using a
    Cache.Dependency). Because the data should be reloaded into the Cache
    I'm also using a callback method.
    But I can't figure out, how to add the data without any time dependency.
    I can't use
    Cache.Insert("Test", test, cacheDependency, Nothing, Nothing,
    Caching.CacheItemPriority.High, onCacheRemove) because this immediately
    reloads the data.

    The data should be removed if the file is changed - and only in that
    case! Any ideas?

    Thanks for help
    Steffen
    Steffen Loringer, Oct 14, 2004
    #1
    1. Advertising

  2. Steffen Loringer

    Hans Kesting Guest

    Steffen Loringer wrote:
    > Hi,
    >
    > i like to store some data in the Cache on the server. The data should
    > be removed once a file on the server is changed (I'm using a
    > Cache.Dependency). Because the data should be reloaded into the Cache
    > I'm also using a callback method.
    > But I can't figure out, how to add the data without any time
    > dependency. I can't use
    > Cache.Insert("Test", test, cacheDependency, Nothing, Nothing,
    > Caching.CacheItemPriority.High, onCacheRemove) because this
    > immediately reloads the data.
    >
    > The data should be removed if the file is changed - and only in that
    > case! Any ideas?
    >
    > Thanks for help
    > Steffen


    I personally don't use callbacks to reload data. When I store things in the Cache,
    I usually have a method to retrieve it. This method checks if the item is cached.

    If it is cached, return that.
    If it isn't cached (file changed, never stored yet) then create the object, cache it
    and return it.

    For duration and time there are constants in System.Web.Caching.Cache:
    NoAbsoluteExpiration and NoSlidingExpiration.

    Hans Kesting
    Hans Kesting, Oct 14, 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. Natty Gur
    Replies:
    1
    Views:
    343
    John McDowell
    Aug 7, 2003
  2. Jeff
    Replies:
    1
    Views:
    345
    Teemu Keiski
    Apr 23, 2004
  3. Dicky Cheng

    absolute expiration doesn't expire cache

    Dicky Cheng, Aug 13, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    507
    Dicky Cheng
    Aug 16, 2004
  4. Guadala Harry

    Cache and Sliding Expiration

    Guadala Harry, Nov 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    11,421
    jongalloway
    Nov 4, 2004
  5. =?Utf-8?B?QnJpYW4gTGluZGVu?=

    Cache Expiration Question

    =?Utf-8?B?QnJpYW4gTGluZGVu?=, Nov 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    374
    Rick Strahl [MVP]
    Nov 16, 2004
Loading...

Share This Page