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.
You should read through the wiki: http://memcached.org/wiki - there're
some programming sections with examples. Using namespacing is probably
similar to what you're talking about with regions.
If you're managing a list, you may also be able to use the append and/or
prepend commands to stack sets of bytes without re-fetching the object.
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.
> 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.
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, 柴俊堃 <chaijun...@gmail.com> 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 <dsalli...@gmail.com>