Caching?

G

Guest

Could someone explain, Caching.

I understand Caching as simply saving a copy of something that is unlikely
to change and to which you frequently refer as opposed to retrieving a fresh
copy every time... like throwing something into Application["myValue"] in
ASP3. Now that Iam all "up to date" everyone wants to Cache everything
because its "good shit!".

How is Cached data any different than data you place in a globally accesible
variable?

p.s.: don't refer me to the BOL as I want an unbiased explanation from real
people who really use/don't use caching
 
G

Guest

Ok, let me try, answer you question, you store in caching, the data that
maybe some time will change, but it's pretty static, and/or data that comes
from an external source that is very expensive to go each time and look for
the data.
 
G

Guest

Bela,
Thanks for the try, but...

I think I understand that. But how is this any different than putting
something in Application["myValue"] for a web app or into a member variable
of a class... as I asked originally?

Bela Istok said:
Ok, let me try, answer you question, you store in caching, the data that
maybe some time will change, but it's pretty static, and/or data that comes
from an external source that is very expensive to go each time and look for
the data.

--
Bela Istok


kevin said:
Could someone explain, Caching.

I understand Caching as simply saving a copy of something that is unlikely
to change and to which you frequently refer as opposed to retrieving a fresh
copy every time... like throwing something into Application["myValue"] in
ASP3. Now that Iam all "up to date" everyone wants to Cache everything
because its "good shit!".

How is Cached data any different than data you place in a globally accesible
variable?

p.s.: don't refer me to the BOL as I want an unbiased explanation from real
people who really use/don't use caching
 
G

Guest

The difference is the Cache has a Timeout and expires, and the Application
variable lives for all the application live. In the Application variable you
go for the value every time you want, the Cache objects notifies you when the
Cache expired, and you can go for the new data only in that moment.

--
Bela Istok


kevin said:
Bela,
Thanks for the try, but...

I think I understand that. But how is this any different than putting
something in Application["myValue"] for a web app or into a member variable
of a class... as I asked originally?

Bela Istok said:
Ok, let me try, answer you question, you store in caching, the data that
maybe some time will change, but it's pretty static, and/or data that comes
from an external source that is very expensive to go each time and look for
the data.

--
Bela Istok


kevin said:
Could someone explain, Caching.

I understand Caching as simply saving a copy of something that is unlikely
to change and to which you frequently refer as opposed to retrieving a fresh
copy every time... like throwing something into Application["myValue"] in
ASP3. Now that Iam all "up to date" everyone wants to Cache everything
because its "good shit!".

How is Cached data any different than data you place in a globally accesible
variable?

p.s.: don't refer me to the BOL as I want an unbiased explanation from real
people who really use/don't use caching
 
G

Guest

OK. But can't this Cache get expensive itself. How do you (I mean you
specificall) decide when to Cache as opposed to using variables. Also I am
assuming that in most instances we are talking about database lookups or
authentication information.

Bela Istok said:
The difference is the Cache has a Timeout and expires, and the Application
variable lives for all the application live. In the Application variable you
go for the value every time you want, the Cache objects notifies you when the
Cache expired, and you can go for the new data only in that moment.

--
Bela Istok


kevin said:
Bela,
Thanks for the try, but...

I think I understand that. But how is this any different than putting
something in Application["myValue"] for a web app or into a member variable
of a class... as I asked originally?

Bela Istok said:
Ok, let me try, answer you question, you store in caching, the data that
maybe some time will change, but it's pretty static, and/or data that comes
from an external source that is very expensive to go each time and look for
the data.

--
Bela Istok


:

Could someone explain, Caching.

I understand Caching as simply saving a copy of something that is unlikely
to change and to which you frequently refer as opposed to retrieving a fresh
copy every time... like throwing something into Application["myValue"] in
ASP3. Now that Iam all "up to date" everyone wants to Cache everything
because its "good shit!".

How is Cached data any different than data you place in a globally accesible
variable?

p.s.: don't refer me to the BOL as I want an unbiased explanation from real
people who really use/don't use caching
 
C

Cor Ligthert [MVP]

Kevin,

I use static classes for this, however AFAIK acts it the same in ASPNET.

Your globally placed variable will be set automatically to null (released)
when a page is sent.

Be aware that the cache and a static class in aspnet belongs to all active
clients (sessions) and will be removed if there are no sessions more active.

I use it is by instance to set ConnectionStrings, data that is not needed
for update.

To store data between sent you have 4 opportunities

viewstates, witch is sent and received every time to/from the client
sessions, which belongs to the client

static classes and caching, which belongs to the complete application and
therefore to all active sessions (without to separate them if you don't do
that).

I hope this was an answer on your question

Cor
 
G

Guest

You are right I use the Cache for Authentication and expensive DB lookups. In
the .NET framework 2.0 we will have an option to link the Cache to a DB
table, and the System will be the responsible to expire the Cache when the
table changes.


--
Bela Istok


kevin said:
OK. But can't this Cache get expensive itself. How do you (I mean you
specificall) decide when to Cache as opposed to using variables. Also I am
assuming that in most instances we are talking about database lookups or
authentication information.

Bela Istok said:
The difference is the Cache has a Timeout and expires, and the Application
variable lives for all the application live. In the Application variable you
go for the value every time you want, the Cache objects notifies you when the
Cache expired, and you can go for the new data only in that moment.

--
Bela Istok


kevin said:
Bela,
Thanks for the try, but...

I think I understand that. But how is this any different than putting
something in Application["myValue"] for a web app or into a member variable
of a class... as I asked originally?

:

Ok, let me try, answer you question, you store in caching, the data that
maybe some time will change, but it's pretty static, and/or data that comes
from an external source that is very expensive to go each time and look for
the data.

--
Bela Istok


:

Could someone explain, Caching.

I understand Caching as simply saving a copy of something that is unlikely
to change and to which you frequently refer as opposed to retrieving a fresh
copy every time... like throwing something into Application["myValue"] in
ASP3. Now that Iam all "up to date" everyone wants to Cache everything
because its "good shit!".

How is Cached data any different than data you place in a globally accesible
variable?

p.s.: don't refer me to the BOL as I want an unbiased explanation from real
people who really use/don't use caching
 

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

Similar Threads


Top