dpy87530 2013-11-14 23:24
浏览 39
已采纳

Memcache是​​否可以在Appengine上运行?

I have an app that tries to store small images (less than 50kB) in memcache, but each call to memcache.Set() results in an error memcache: server error. I'm on the shared memcache class, so I understand there is no service guarantee, but currently I have no service at all. Is it a temporary outage? Am I just unlucky?

Here is the piece of code creating an item and calling memcache. ctx is the appengine context for the request. memkey is my key (a string). img_data is a string with my data. This code works well in the local dev environment.

cache_item = &memcache.Item{
    Key: memkey,
    Value: bytes.NewBufferString(img_data).Bytes(),
}
err = memcache.Set(ctx, cache_item)
if err != nil {
    ctx.Infof("Could not store image in memcache: %s", err)
}
  • 写回答

1条回答 默认 最新

  • duanken7168 2013-11-17 07:51
    关注

    If it's still happening, file a bug, but I suspect it was just a transient problem.

    Incidentally, your Value initialiser is unnecessarily complex. This would work the same:

    cache_item = &memcache.Item{
        Key:   memkey,
        Value: []byte(img_data),
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥15 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services