dongshanjin8947
2014-04-27 10:59
浏览 10
已采纳

如何添加一个现有的密钥memcache php数据?

I have a large amount of data in memcache, and currently i am troubling with How can i update value on memcache?

I have set value with multi-dimention array..

and now i have two cases here:

  1. I want to add new value in Memcache in same key
  2. I want to update some value of one particular array.

I know i can do that by get -> modify -> set

$data=$m->get('foo');

$data[]=array('id'=>134,'title'=>'My First Car','content'=>'I love my car');

$m->set('foo',$data,TRUE,0);

In this example..user can change its title, content etc. so i need to update these information in memcache.

But getting data on every change which is more than 1MB, that will not be a good idea.

and I also learn about append but it says it only works for string values. that means i can not append Array to with existing key.

Is there any way to set/update data on existing key without getting data?

Please help..

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题