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),
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示