<newbie> using cache when objects in cache is modified

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hi

asp.net 2.0

In a webpage I have a GridView displaying a collection of data. This
collection of data is a collection of objects based on a custom class. where
each object represent a record in the database..

this collection is stored in the cache so that maybe next time a trip to the
database isn't needed

If I modify data in the GridView: I have a ButtonLink in my GridView, when I
click on it a field in the database is updated.
After this update is done nothing is displayed, that's because the GridView
gets the data from the cache... Only when cache is outdated (1 hour) a full
read from database is done and a new cache is created.....

But I'm wondering if it's good practice to when a object like this is
modified to loop through the entire cache and remove the modified object and
replace it with the updated version?
 
what if I instead of removing the object in cache, I just give it the new
value which was placed in the database... then I don't need to remove the
object and insert a new object....good approach?
 
"what if I instead of removing the object in cache, I just give it the new
value which was placed in the database... then I don't need to remove the
object and insert a new object....good approach? "

I guess that is a bad solution. Because items are sorted based on this
column in my GridView. If I update this field then perhaps this row should
be removed from this page. because my GridView has enabled paging and this
row should be on another page after this update..... any suggestions?
 
Back
Top