Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Application State and Custom Collection Maintenance

Thread Tools

Application State and Custom Collection Maintenance

Jeff S
Posts: n/a
I'm storing a list of widgets in a database. The list changes infrequently
(twice per week at most), and is relatively short (200 items at most, with
very little detail per item). A small subset of all possible widgets will be
displayed on a page (using VB.NET/code behind). I plan to populate a custom
collection/class with a list of all possible widgets. The class will include
a method that returns the required subset. Of course the logic will have to
hit the database in order to populate a custom collection. Because I want to
minimize the number of hits on the database, and because the class will hold
relatively little data, and because and the data is identical for all users,
I think it makes sense to maintain it in the Application state.

My questions:
1. When/where should I instantiate and initialize the custom
collection/class? It seems that if I do it in the page_load event of
Default.aspx, that I'd hit the database too much (every time a user opens
the application). But, if not during that event, then when should it be

2. When the list of widgets gets updated in the database (twice per week or
so), the custom collection/class would need to be refreshed in order to
include the changes made in the database. What would be a good stragegy for
keeping the custom collection/class synchronized with the database?

Thanks in advance.


Reply With Quote
Natty Gur
Posts: n/a

1) You can initialize the cache in application_onstart event.
(Initialization will happen just once).

2) You can use two attitudes:
- wrap accessing cache data with method that will check if cache
expired and if expired re-add the data from DB to cache.
- catch the callback event that send by cache after the cache releases
the data and add again the data from the DB.


Natty Gur[MVP]
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wizard Design and State Maintenance Jeremy S. ASP .Net 12 07-28-2009 01:27 PM
AJAX and State Maintenance Scott McNair ASP .Net 3 12-09-2008 10:57 PM
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Řyvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
Multiview, server controls and state maintenance ewolfman ASP .Net Web Controls 0 10-17-2005 02:44 PM
Help on maintenance state information ??? =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?= ASP .Net 1 09-13-2005 02:04 PM