如何更新数据存储中保存在内存缓存中的数据?

How to update data in datastore, saved in the memcache?

我正在处理我必须使用的数据存储项目 memcache。但是因为我以前从未使用过 memcache 所以我对它感到困惑。我关注 this link 并成功地从内存缓存中保存和检索值。

$memcache = new Memcache;
$value = $request->getContent();
return $memcache->set($key, $value);

$memcache = new Memcache;
return $memcache->get($key);

所以当我只想获取用户的详细信息并将其保存到 memcache 时,这对我来说就足够了。但问题在于将 memcache 中的值插入数据库。谁能指导我如何处理它。我是否应该将用户的编辑保存到 memcache 中,当他进行编辑时以及尝试注销时,我应该首先将所有更改保存到数据存储中,还是有一些其他解决方案可用于稍后进行更改?请帮助我。

不要把它想成 "inserting data from memcache to the database" - 没有什么特别的。您只是将刚好从内存缓存中检索到的数据(以通常的方式)插入到数据库中。