469,580 Members | 2,040 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,580 developers. It's quick & easy.

Caching?

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
Nov 17 '05 #1
6 1375
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" wrote:
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

Nov 17 '05 #2
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" wrote:
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" wrote:
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

Nov 17 '05 #3
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" wrote:
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" wrote:
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" wrote:
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

Nov 17 '05 #4
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" wrote:
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" wrote:
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" wrote:
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" wrote:

> 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

Nov 17 '05 #5
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
Nov 17 '05 #6
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" wrote:
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" wrote:
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" wrote:
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" wrote:

> 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" wrote:
>
> > 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

Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by moko | last post: by
reply views Thread by Troy Simpson | last post: by
3 posts views Thread by Janaka | last post: by
2 posts views Thread by George1776 | last post: by
4 posts views Thread by Hermann | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.