Items removed from cache without a reason, why? (CacheItemRemovedReason)

Discussion in 'Software' started by angeladipierro, Nov 2, 2010.

  1. angeladipierro

    angeladipierro

    Joined:
    Nov 2, 2010
    Messages:
    2
    Hi,
    I've developed a timerjob that adds a lot of XmlDocument objects to the cache of a web application.
    I've used this code to add the object to the cache:

    Cache.Insert(XMLKey, doc, dependency, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(24, 0, 0), System.Web.Caching.CacheItemPriority.Normal, onRemove);

    Parameters represent the following:
    XMLKey --> The cache key used to reference the object
    doc --> the XmlDocument object
    dependency --> the file dependency for the item to invalid the cache
    System.Web.Caching.Cache.NoAbsoluteExpiration --> absolute expiration, in this case the cache should never expire
    new TimeSpan(24, 0, 0) --> sliding expiration, in this case the cache should expire after 24 hours
    System.Web.Caching.CacheItemPriority.Normal --> Cache item priority
    onRemove --> a delegate (CacheItemRemovedCallback) called when the item is removed from the cache for any reason

    I need to keep all the objects in cache until their expiration (24 hours), but they are removed automatically after one or two hours!
    I use the delegate onRemove to understand the reason of this behavior. In order to do this I print out the CacheItemRemovedReason value and this is REMOVED.
    On msdn I've found this about REMOVED as value of CacheItemRemovedReason property:
    REMOVED --> The item is removed from the cache by a Remove method call or by an Insert method call that specified the same key.
    The point is that I do not call any Insert method with the same key neither any explicit Cache.Remove() method. So I don't understand what causes the removing of all my items. :S

    Any idea about this issue? Please, could anyone help me?

    Thanks a lot.
    Angela
     
    angeladipierro, Nov 2, 2010
    #1
    1. Advertising

  2. angeladipierro

    angeladipierro

    Joined:
    Nov 2, 2010
    Messages:
    2
    Ops... the programming language used is C#, Framework 3.5.
     
    angeladipierro, Nov 2, 2010
    #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. Ben Lord

    Items in Outbox not moving to Sent Items

    Ben Lord, Oct 23, 2003, in forum: Computer Support
    Replies:
    0
    Views:
    966
    Ben Lord
    Oct 23, 2003
  2. Skip M
    Replies:
    4
    Views:
    293
    Ed E.
    Apr 2, 2004
  3. Skybuck Flying
    Replies:
    2
    Views:
    680
    Skybuck Flying
    Feb 27, 2008
  4. Moke Gibboni

    Taskbar - Past Items back into Current Items

    Moke Gibboni, Oct 28, 2008, in forum: Computer Support
    Replies:
    5
    Views:
    1,553
    Moke Gibboni
    Oct 29, 2008
  5. Geopelia

    Deleting items to deleted items folder.

    Geopelia, Nov 1, 2012, in forum: NZ Computing
    Replies:
    16
    Views:
    531
    Geopelia
    Nov 13, 2012
Loading...

Share This Page