Solved

how does it work ???

Posted on 2008-10-20
6
167 Views
Last Modified: 2012-05-05
Hi,
   I have a situation as follows :

I have a bunch of my website settings which i named it as WebSettings (a class which holds all these settings).

I create object of this class on first call and store it in Cache object for all future uses.


Now one browser is accessing the Value of a particular setting from Cache.

Meanwhile i changed the system setting value and new browser is opened to access the setting.

My question is is there 2 different copies of Cache available for 2 browser instances or Cache would be same.
0
Comment
Question by:Paramhans
6 Comments
 
LVL 15

Expert Comment

by:angus_young_acdc
ID: 22765265
From memory you would have to create two seperate caches, otherwise it will all be stored in 1 default cache where if one browser changes a value (and stores it in the cache) then the 2nd browser would read the updated value.
0
 
LVL 13

Expert Comment

by:crazyman
ID: 22765357
This depends on how you are storing it, i presume your using HttpContext.Current.Cache.
What are you using as the Key ?
0
 
LVL 6

Expert Comment

by:AmarIs26
ID: 22765359
Cache is global just like Application object. It is optimised for faster and safer read/write. So if you need to store something that will be used by all users then use cache. However if you need to use settings which are per user, then you should make use of the Session which is user specific.

1 Cache -> Shared by All browsers/users
1 Session -> Shared by one user/ One unique instance of the browser
1 Application -> Shared by all browsers/users
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Expert Comment

by:johnhumenik
ID: 22773425
It might be ok to use a database table and store the settings there.  If you wanted to keep the settings the same across all instances of your application you would just load the data everytime from the database.  You could version the data or setup temp areas where settings can change on a per user basis or allow global changes.  That way you have complete control over the data and can even load that data into a memory (class / struct) as needed.  
0
 

Author Comment

by:Paramhans
ID: 22793650
Hi thanx 4 the replies.

But to be very precise i want answer to my question.

My question is is there 2 different copies of Cache available for 2 browser instances or Cache would be same.

thanx in advance
0
 
LVL 6

Accepted Solution

by:
AmarIs26 earned 200 total points
ID: 22794121
The httpcache would be the same for two browser instances. A unique instance is when you open ie twice from windows. If you open a new window from existing browser window then that is not unique instance.
Anyways, cache will be same for two browser in stances.
Session will be different for two browser instances.
if you still wanted to use cache then you could use the sessionid as key for your cache data
sessionID+key = keyfor cache.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Convert string to date 3 40
Default parameter problem in C# 3 27
Trouble with References... 5 25
Hidden Field Value 10 37
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video discusses moving either the default database or any database to a new volume.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now