jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Cronin" <tcro...@interwoven.com>
Subject RE: CacheElement key and val
Date Wed, 14 Feb 2007 15:10:27 GMT
>I have only one type of object that I want to put in the
>cache. Should I use it as both key and val?

This kind of defeats the cache since you would need to have the object
to retrieve it. You would want to have some minimum unique identifier,
like if your caching DB results you could use the query as your key.

>Also, if two cache element have the same key (key1.equals(key2)), does
it
>require that they should have the same val (val1.equals(val2))?

yes, think of it as a Map.

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html


-----Original Message-----
From: Sam Wang [mailto:wang2xu4@gmail.com] 
Sent: Wednesday, February 14, 2007 12:53 AM
To: jcs-users@jakarta.apache.org
Subject: CacheElement key and val

Hi,

What is the general practice to create key and val in order to create
the
cache element? I have only one type of object that I want to put in the
cache. Should I use it as both key and val?

Also, if two cache element have the same key (key1.equals(key2)), does
it
require that they should have the same val (val1.equals(val2))?

Thanks.

-Sam

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Mime
View raw message