We have implemented a java solution which uses memcached, the client
being xmemcached.

We are using a multiget feature, which has helped in improving
performance.

Is there any recommendations around how many objects should I try to
fetch using multiget at a time.

The default timeout is one sec, which could be changed by passing a
parameter

On Nov 23, 7:37 am, 柴俊堃 <[email protected]> wrote:
> Hi:
>     I'm a java programer. accroding to ur question, I made a test to verify
> my solution that u can use Collection Object. what I use memcached client
> is
> java_memcached-release_2.6.2.jar which is 
> fromhttps://github.com/gwhalin/Memcached-Java-Client/downloads
>
>     My test as following:
> class Person implements Serializable{
>  /**
>   *
>   */
>  private static final long serialVersionUID = 4468130987525379646L;
>  private String name;
>  private int age;
>  public String getName() {
>   return name;
>  }
>  public void setName(String name) {
>   this.name = name;
>  }
>  public int getAge() {
>   return age;
>  }
>  public void setAge(int age) {
>   this.age = age;
>  }
>  public Person(String name, int age) {
>   super();
>   this.name = name;
>   this.age = age;
>  }}
>
> *Important: u must implements Serializable interface. cuz the framework
> send object to memcached server by socket finally.*
> then, to use:
>
>   Person p1=new Person("Jack", 20);
>   Person p2=new Person("Rose", 30);
>   LinkedList<Person> ll= new LinkedList<Person>();
>   ll.add(p1);
>   ll.add(p2);
>   if (memcacheService.add("KeyList", ll)){
>    System.out.println("success to add linked list");
>   }else{
>    System.out.println("fail to add linked list");
>   }
>   @SuppressWarnings("unchecked")
>   LinkedList<Person> tt= (LinkedList<Person>)memcacheService.get("KeyList");
>   System.out.println("object count in linked list:"+tt.size());
>   Person p3=tt.get(0);
>   Person p4=tt.get(1);
>   System.out.println(p3.getName()+p3.getAge());
>   System.out.println(p4.getName()+p4.getAge());
>
> may my code helps u!
>
> 2011/11/23 Dustin <[email protected]>
>
>
>
>
>
>
>
>
>
>
>
> > On Tuesday, November 22, 2011 12:07:15 PM UTC-8, Dormando wrote:
>
> >> > Dormando,Quick question.
>
> >> > So if I were to�
>
> >> > put (key, array_of_size_3)
> >> > and then
> >> > append (key, new_item)
>
> >> > value = get (key)
> >> > size of value will be 4 ?
>
> >> if array_of_size_3 is "3 bytes", and new_item is "1 byte", then yes.
> >> remember that if you're appending complex structures, you still need to be
> >> able to parse what you get back.
>
> > This entirely depends on the format of your data.  If whatever you are
> > storing can be concatenated and make a larger version of it, then yeah.  If
> > it's something like a JSON array, then no.
>
> --
> 柴俊堃 敬上

Reply via email to