Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Caching 2

Status
Not open for further replies.

litton1

Technical User
Apr 21, 2005
584
0
0
GB
Hi all,

I have a telephone number that comes from the DB into a label. What is the best way I can I cash this for all visitors of the page, but only this?

Thanks L


Age is a consequence of experience
 
It's cache, not cash. LOL
Anyway, this is not something that should be cached. This should go into the web.config. This way
if the number ever needs to be changed, there is no code to release, you simply edit the web.config.
 
Hi thanks for the lesson English lesson 

It need's to be in the database though.

Age is a consequence of experience
 
Then you can simply put it into a session variable. You can load it in the application_start event in the Global.asax.
 
Thanks. That’s exactly what I wanted. Please excuse the typos.
L

Age is a consequence of experience
 
Glad I could help you!
And I was only kidding with the typos.. [smile]
 
As an afterthought, if the phone number is system wide and not user specific you could use the application cache with an absolute expiration so it gets refreshed periodically in case the dB value changes. This would mean on dB hit rather than one per user session with the cached value being available to all application users...

..just a thought.

Rhys

"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
Albert Einstein
 
Yes this is global for all users. Thanks

Age is a consequence of experience
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top