By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

Access Cache from Another Thread?

P: n/a
In one of our ASP.NET Pages, we are starting a new background thread that we
do not need to go and get any status on or use after the page finishes. The
thread merely does some background stuff on its own and finishes on its own,
no feedback back to the user (by design). Within that thread however, some
items need to be accessed and/or inserted into the Cache for possible
subsequent processing by another page. Many examples I see of background
threads include access to the Session object however in our tests here we
found we could not access the Response or Request objects in a background
thread, which is by design.

We passed in the Cache object as a property to our background thread and can
access it just fine, but we wanted to know if this was an okay way to access
the Cache from a background thread or are there better ways of accessing
Cache from a background thread?

Thanks so much I appreciate it!

Christopher

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The cache isn't tied to a specific request or response so I don't see any
problem accessing the cache from a background thread.

The only reservation I'd have is over this statement:
some items need to be accessed and/or inserted
into the Cache for possible subsequent processing by another page.
The cache can expire items and kick them out of the cache if there is some
memory pressure. What happens if the next page doesn't find the results computed
by the background thread in the page?

--
Scott
http://www.OdeToCode.com/blogs/scott/
In one of our ASP.NET Pages, we are starting a new background thread
that we do not need to go and get any status on or use after the page
finishes. The thread merely does some background stuff on its own and
finishes on its own, no feedback back to the user (by design). Within
that thread however, some items need to be accessed and/or inserted
into the Cache for possible subsequent processing by another page.
Many examples I see of background threads include access to the
Session object however in our tests here we found we could not access
the Response or Request objects in a background thread, which is by
design.

We passed in the Cache object as a property to our background thread
and can access it just fine, but we wanted to know if this was an okay
way to access the Cache from a background thread or are there better
ways of accessing Cache from a background thread?

Thanks so much I appreciate it!

Christopher

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.