Shared DataTable in web environment


Author
Message
ChanKK
ChanKK
StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

I would like to use shared data table so that every session shared the same data. May I know any thing I need to taken into consideration while using it?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
In a web environment you are better off create an application BO versus creating a shared data table.  This would be due to primarily the session states.  But if you are wanting to share a BO across all user sessions, then create an application level BO instance versus a shared data table.
ChanKK
ChanKK
StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

Thank you.

If I would like implement cache to these "common" Business Object data, any recommended caching tool/framework?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You can you create one of these yourself quite easily.  As you may already be aware, the BO has the ability to serialize and deserialize out-of-the-box.  So if you want to save these sesssions off to disk you can.  Now if you are just going to hold these in memory then this is not necessary.  In any case, you can create a Dictionary of keys and BOs that are static at the application session level so that they are shared across all sessions.  So in the global.asax I would instantiate my dictionary and when a reference is made and a key does not exist, then add one to the cache.  You could also load all of them up at the beginning as well.  But to do this, just create a static dictionary that is stored off as an application variable and then manipulate the cache as needed during the life of the object.
ChanKK
ChanKK
StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)StrataFrame User (416 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

Thank you for your explanation.

How could I manage its "expiration period"? I would like to cache active employee list which might contains > 10,000 records. I can cache it using static variable and so, but everyday also might have new join and resign employee. Therefore, I need to refresh it intervally. That is the reason I looking for caching mechanism.



Please advice. Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, this is not a simple question as there are a lot of ways to handle this.  First of all, you can set timeouts at the IIS level in regards to the application pool being recycled.  So this is when you may want to cache the BOs to a database so that they can be retrieved in their state prior to being disposed.  This is not something that I can give you a straight answer on without first setting something like this up and playing with it a while.  But I know that you could tackle this several different ways.

This is why I was mentioning the serialization so if you had the need to save off the state and then restore a state between sessions. 

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search