Context.Items vs Context.Cache

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

There doesn't seem to be much doc on Items vs Cache in HttpContext.

Basically I want to instantiate a class at web application level so
that all web pages can have access to it. The object would have the
life span of the application itself.

Can anyone point me in right direction regarding Items vs Cache?

Richard
 
Hello!

The Context.Items should be seen as shortlived data store (cache), that
exists for a single http request. This means it is private to the http
request.

The Context.Cache is a shared data store, that allows you to e.g.
instantiate your class at application level, add it to the cache (with
expiration settings if required), and share the instance between all http
requests.

If this doesn't answer your question, please let me know.
 

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

Back
Top