Well, if I need to put another object in the collection, I need to first get it the existing object from the cache. And then insert this new object within that collection. Reducing performance by that much. But I understand that perf will not drop considerably since a get is much faster, and its only 1 more get for every put.
If memcached would provide such a feature, it would have to manage a collection instead of a value. And allow a api to "insert duplicate". And fetch a collection instead of a object. Much faster than the former approach above. Ok, let me ask this question (sorry if Im being lame here, just point me to the doc's if I missed something). Is there a way to define a set (or region as it would be on microsoft velocity) ? Siddharth On Tue, Nov 22, 2011 at 12:27 PM, dormando <dorma...@rydia.net> wrote: > > Hi All, > > My scenario needs me to retrieve multiple objects that have the same > key. Infact my scenario needs me to identify objects using multiple keys > too, > > but I can solve the multiple keys problem by adding one more entry to > memcached. So thats not my question. Is it possible to store multiple values > > using the same key ? > > > > A parallel caching technology is Velocity " > http://msdn.microsoft.com/en-us/magazine/dd861287.aspx". Here we can > create something called regions, > > within a cache instance. And I can split my data between regions. So > that I dont need to store multiple values using the same key. I can just > create > > regions, and every region can host my unique data. > > > > I also referred to " > http://stackoverflow.com/questions/1049833/multi-valued-hashtable-in-java". > I think its possible in java. But wondering if there > > is a parallel in memcached (or should I do it the hard way/slower way, > store a map as value, get, add, set). > > Collections aren't supported. Your options are to pack multiple values > into a single key (Not sure why this is an issue? If you're fetching it > all back anyway...), or to give them different keys and issue multigets to > fetch item collections back. > > It's really never an issue in practice. If so I'd like to see benchmarks > or code showing otherwise :/ Unless there's some specific feature about > collections that you're looking for. >