2 questions re data caching and session objects

W

Wee Bubba

2 questions please:

1. At the moment I make a connection to a database whenever a user
logs into my website. I run a few SQL's then store some commonly used
dataTables in session objects for quick access throughout my
application.

I am not caching my dataTables because each of my users are directed
to their own individual company databases. So the contents of these
dataTables will differ from user to user. I have read that data
caching exists only at the application level so I am assuming that I
could only cache these dataTables if my users were connecting to the
same database and therefore had the same data within these
dataTables. Is that correct please?

2. Let's say Joe Bloggs from Company A connects to my website. I store
some commonly used dataTables for that user inside a session objects.
Some of the dataTables are specific to that user so this is OK.
However other dataTables are generic for Company A.

Would it be possible to implement logic that would store certain
dataTables inside session objects on a per user basis, but store
other dataTables inside session objects on a per company basis?

p.s. I do not say on an application level basis here because, as per
question 1, I will have users logging in from different companies to
my application who will need to store completely different data.

many thanks.
 
S

Scott Allen

The Cache is application wide, but you store and retrieve items based
on a key. By putting a company identifier into the key, you could
cache inforormation for each company of users, i.e:

string cacheKey = companyId + tableId;

Cache.Insert(cacheKey, dataTable);


HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top