Adding an item to existing cache that is in the from of dataset

Last post 07-03-2009 7:09 AM by MartijnG. 6 replies.

Sort Posts:

  • Adding an item to existing cache that is in the from of dataset

    06-28-2009, 2:45 AM
    • Member
      68 point Member
    • MartijnG
    • Member since 06-22-2002, 9:07 PM
    • Posts 55

    Hi

    I’m using a cache dataset that is the later bound to a drop down list. I need to be able to add an extra entry to the cache.

    I’ve found the .add method doesn’t not seem to work when the cache is a dataset.

    I’ve also attempted to work this by pulling the cache into a dataset, adding a new entry to the dataset, removing the original cache and then reinserting the dataset but working through some problems with this.

    Is there a far easier approach to this anyone knows about?

    Any feedback appreciated.

    Martijn :)

     

  • Re: Adding an item to existing cache that is in the from of dataset

    06-28-2009, 7:20 AM
    • Star
      12,035 point Star
    • malcolms
    • Member since 06-12-2008, 12:38 AM
    • Melbourne, Australia
    • Posts 1,986

    I think it would be a better option to add just the data to the cache, not the entire dataset.  The website will consume far less memory that way.

    Sincerely,
    Malcolm Sheridan

    Microsoft Certified Solution Developer
    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
    Answer" if a marked post does not actually answer your question.
  • Re: Adding an item to existing cache that is in the from of dataset

    06-28-2009, 5:25 PM
    Answer
    • Member
      68 point Member
    • MartijnG
    • Member since 06-22-2002, 9:07 PM
    • Posts 55

    I finally got it working.

    The method I used was.

    1. Pull the cached dataset into a local dataset
    2. create a new dataset and add my one manual entry
    3. All the data from the dataset in step (1) to this dataset also
    4. remove the cached dataset
    5. Reinsert the data set from step (3) into the cache as a whole dataset

    Quite a lot of mucking around I could not take the existing cached dataset and just add one entry to it be using cache.add

    I’m still wondering if there is something I’ve missed, I’ve spend a fair bit of time on this and couldn’t get much happening by directly adding a row to the cached dataset until I used the above 5 steps.

    Regards

    Martijn :)

  • Re: Adding an item to existing cache that is in the from of dataset

    06-28-2009, 7:33 PM
    • Member
      18 point Member
    • gayan_aspnet
    • Member since 06-26-2009, 8:31 AM
    • Melbourne
    • Posts 6

     didn't you try by casting the cache object to data set without putting it in to whole new dataset? because, cache returns generic object rather than a particular type. just give it a try!

    ((DataSet)Cache['xxx']).methodname()

    cheers!

     

    MCP
    Gayan W
  • Re: Adding an item to existing cache that is in the from of dataset

    06-30-2009, 6:26 AM
    • Member
      68 point Member
    • MartijnG
    • Member since 06-22-2002, 9:07 PM
    • Posts 55

    Thanks Gayan

    I'm still a bit stuck for examples on where to start. Do you know of any good links to examples?

     

    Regards

     

    Martijn

  • Re: Adding an item to existing cache that is in the from of dataset

    07-01-2009, 11:25 PM
    Answer
    • Member
      18 point Member
    • gayan_aspnet
    • Member since 06-26-2009, 8:31 AM
    • Melbourne
    • Posts 6

     u r welcome!

    u can start from here..this is really good for a start

    http://quickstarts.asp.net/QuickStartv20/aspnet/doc/caching/default.aspx

     

    MCP
    Gayan W
  • Re: Adding an item to existing cache that is in the from of dataset

    07-03-2009, 7:09 AM
    • Member
      68 point Member
    • MartijnG
    • Member since 06-22-2002, 9:07 PM
    • Posts 55

    thanks Smile

Page 1 of 1 (7 items)