>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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]