about the duwamish 7.0

  • Thread starter Thread starter Kylin
  • Start date Start date
K

Kylin

In PageBase.cs file,

private const String KEY_CACHECART = "Cache:ShoppingCart:";
..
..
..
..


Cart returnValue = (Cart)(Session[KEY_CACHECART]);


meaning ?
any help or document about this ?
 
This means that the object stored in the session key "Cach:ShoppingCart:" is
explicitly casted to an object of type Cart.

Gabriel Lozano-Morán
 
Hi,

The code is just storing the value of Cart object in the session
provided by asp.net
Now when you store the value in the session you need a key with which
you can identify it uniquely.
Also when you get the value from the session it is of "Object" type
which you have to cast into the object with which you stored that in
the session.

So while storing the value, the code should look like:

Session[KEY_CACHECART] = objCart;

where objCart is object of Cart type. So while retrieving it being cast
back to Cart
HTH,
Regards,
Angrez
 
"Cache:ShoppingCart:" is just a name they give the key. It could have been
Cache_ShoppingCart_ or CacheShoppingCart or whatever. But I assume that the
name is a concatenation of strings.

Gabriel Lozano-Morán
Software Engineer
Sogeti
 
Ok..I see why you are so confused. You don't know what a cache is and how
is it used in asp.net. Take a look at this:

http://www.dotnetjunkies.com/quickstart/aspplus/doc/cachingoverview.aspx

--
TDAVISJR
aka - Tampa.NET Koder


Kylin said:
Session,and the cach ..?
Put the session's value into cach ?


Hi,

The code is just storing the value of Cart object in the session
provided by asp.net
Now when you store the value in the session you need a key with which
you can identify it uniquely.
Also when you get the value from the session it is of "Object" type
which you have to cast into the object with which you stored that in
the session.

So while storing the value, the code should look like:

Session[KEY_CACHECART] = objCart;

where objCart is object of Cart type. So while retrieving it being cast
back to Cart
HTH,
Regards,
Angrez
 
Back
Top